1

When I am running my selenium code I get the error "error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context"

I am having Firefox 48.0 Using gecko driver i have initialized browser. And getting the above mentioned error.

Louis
  • 146,715
  • 28
  • 274
  • 320
Ashwini.J
  • 177
  • 2
  • 14
  • 1
    The bug is in the library tool, not the users code. It would be helpful if people could find a workaround for this issue (in other words it could have helped me to allow a proper answer). – Dave McNulla Sep 08 '16 at 02:23

1 Answers1

7

Issue is resolved as there is problem "In the current revision (after 0.9.0), the argument webdriver-port was renamed to port. This causes selenium to fail launching firefox via geckodriver, returning an invalid argument error in geckodriver" hence have downgrade the geckodriver v0.10 to v0.9. now it is working for me

Ashwini.J
  • 177
  • 2
  • 14
  • selenium 2.53.1 works with geckodriver 0.9.0 and selenium 3.0.0-beta2 with 0.10.0 – hennr Aug 26 '16 at 13:27
  • 3
    I worked around this problem by using creating a virtual environment ```virtualenv workaround``` then install selenium with ```pip install selenium```, then modifying the workaround/lib/python3.5/site-packages/selenium/webdriver/firefox/service.py in that env to replace '--webdriver-port' with '--port' (2 places). The last step was to enable the virtual env ```source woraround/bin/activate```. I assume 0.11 with be OK. – Dave McNulla Sep 08 '16 at 02:25
  • 1
    ``` # Set a port for CDP # if "--connect-existing" not in self.service_args: # self.service_args.append("--websocket-port") # self.service_args.append(f"{utils.free_port()}") ``` Just comment out three lines: `53,54,55` – Constantine Kurbatov Feb 24 '23 at 09:01