Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context .

When I run my selenium code, I get this error error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context Am having Firefox browser using gecko driver initialized and am getting the above mentioned error (this is the entire error log Deniss-Air:qaframework-bdd-tests juliet$ npm run refapp2OpenConceptLab> op - Pastebin.com). Could it be The --websocket-port argument was added in Geckodriver version , so I must use the Gecko version to avoid the error? friends, how are you going about this issue? However, on chrome everything is okay as reflected here Deniss-Air:qaframework-bdd-tests juliet$ npm run refapp2OpenConceptLab> open - Pastebin.com.

Share the content of test.properties file!

webapp.url=https://qa-refapp.openmrs.org/openmrs

login.username=admin

login.password=Admin123

login.location=Pharmacy

webdriver=firefox

login.auto=true

headless=false

webdriver.gecko.driver=firefoxdriver/mac/geckodriver

includes.csrftoken=true

Download a firefox driver that is compatible(of the same version) with the firefox browser running on your machine and run the test again!

I have just download firefox 97.0.1 and when I run the tests I get the same error as above.

What is the version of firefox browser running on your machine?

The --webdriver-port option may have been removed in favor of just --port (CHANGES.md - mozsearch)

Removed

  • Dropped support for legacy Selenium web element references

    The legacy way of serialising web elements, using {"ELEMENT": <UUID>}, has been removed in this release. This may break older Selenium clients and clients which are otherwise not compatible with the WebDriver standard.

    Thanks to [Shivam Singhal] for this patch.

  • Removed --webdriver-port command-line option

    --webdriver-port <PORT> was an undocumented alias for --port, initially used for backwards compatibility with clients prior to Selenium 3.0.0.

1 Like

firefox 97.0.1(64bit)

Thanks so so much! your explanation rhymes the explanation on this stackoverflow. My fear is how to implement the proposed solution without interfering with what is already in place.

You’re welcome. Seems as though the options are to upgrade Selenium or downgrade the geckodriver.

Another option is having your driver locally that is compatible with your browser. This method is a little handy but it can rescue. Have the driver local on your machine similar to the firefox version you running and at the time of testing, change the driver from openmrs-contrib-qaframework/qaframework-bdd-tests/src/test/resources/firefoxdriver/linux. All this is supposed to be for testing locally before pushing. Note, You dont need to commit this driver. And this will help you as well.

I had the firefox drivers which were compatible with my browser and everything was working pretty well then from no where it throw the above error.

I did as proposed but still getting the same error. The worst part is chrome which was also working is now throwing an error.

@sharif, @kdaud and @sjmckee am so grateful for your responses. I have solved the issue. How I don’t know because I have done many things and I know which one fixed.

1 Like

So which one is that? :slight_smile:

Oh sorry! I don’t know what I did that fixed the issue to be specific on the firefox browser . That is what I was trying to communicate.