Skip to content

Unable to start geckodriver when running Karate v2 in standalone mode #2884

@rzabini

Description

@rzabini

Description

Timeout when running a feature using browser automation with Firefox geckodriver.
I think this is due to how Karate v2 builds the arguments to use in ProcessBuilder to run geckodriver, i.e. it leaves a space between "--port" and the actual port number, buit it packs all in a single argument:

public enum W3cBrowserType {
...
    GECKODRIVER("geckodriver", "firefox", "geckodriver", 4444, "--port %d"),

W3cDriver class:

command.add(executable);
        command.add(browserType.formatPortArg(port));
        command.addAll(opts.getAddOptions());

        try {
            ProcessBuilder pb = new ProcessBuilder(command);

I think the format should be "--port=%d".

The same feature works just finw with karate 1.5.1.

Steps to Reproduce

1 Given a feature file with:

* configure driver = { type: 'geckodriver', headless: false }
Given driver 'https://www.google.com'
  1. Run it with:
    java -jar karate-2.0.9.jar firefox.feature

Expected Behavior

To see the Firefox window open, and navigate to the site URL

Actual Behavior

No Firefox window opens, and feature fails with the message:
Timeout waiting for WebDriver on localhost:4444

Karate Version

2.0.9

Java Version

21.0.7

Operating System

Windows

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions