获取错误:找到参数'--webdriver-port',这是不期望的,或者在此上下文中无效

Ash*_*i.J -1 java testing selenium firefox-marionette geckodriver

当我运行我的selenium代码时,我收到错误"错误:找到参数'--webdriver-port'这是不期望的,或者在此上下文中无效"

我正在使用Firefox 48.0使用gecko驱动程序我已经初始化了浏览器.并得到上述错误.

Ash*_*i.J 6

问题解决,因为存在问题"在当前版本中(在0.9.0之后),参数webdriver-port被重命名为port.这导致selenium无法通过geckodriver启动firefox,在geckodriver中返回无效参数错误"因此已降级geckodriver v0.10到v0.9.现在它正在为我工​​作

  • 我通过使用创建虚拟环境“virtualenv workaround”解决了这个问题,然后使用“pip install selenium”安装selenium,然后修改workaround/lib/python3.5/site-packages/selenium/该环境中的 webdriver/firefox/service.py 将 '--webdriver-port' 替换为 '--port' (2 个位置)。最后一步是启用虚拟环境“source woraround/bin/activate”。我假设 0.11 就可以了。 (3认同)