2016-06-14 37 views
1

使用Mars.2 Release(4.5.2)和Firefox 47.0来运行我的硒代码,但每次运行时我都是得到这个Firefox 47.0,硒selenium-java-2.53.0 windows64 org.openqa.selenium.remote.UnreachableBrowserException

堆栈跟踪:

"Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: 
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." 
+0

的可能的复制[无法打开浏览器与Firefox更新后硒(http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update) – Mobrockers

+1

同意以上,可能重复。这个问题是由于Firefox转移到多进程(代码名称e10),需要新的驱动程序来处理这个问题。这是一个已知的问题,开始启用e10的firefox开发者版本。 – mootmoot

+1

MDN也修改FF 47.0,降级到46使用新的驱动程序。 https://github.com/seleniumhq/selenium/issues/2110 – mootmoot

回答

4

火狐47.0最近走了出来,用一个新的驱动程序必须使用由Mozilla的,而不是由硒制成。请参阅Marionette Driver

下载此驱动程序并确保可执行文件在您的系统路径中。现在,你需要改变你的程序,以便它使用该驱动程序设置所要求的功能:

dc = DesiredCapabilities.FIREFOX 
dc['marionette'] = True 
driver = webdriver.Firefox(capabilities=dc) 
0

降级您的Firefox版本46.0 FF作为FF 47.0对webdriver的不支持。一旦降级的火狐浏览器,并按照以下提到的步骤禁用自动升级选项:

  1. 打开Firefox:按F10>工具>选项

  2. 转到高级选项卡

  3. 导航到“更新”选项卡

  4. 取消选中'使用后台服务安装更新'选项

  5. 取消选中“自动安装更新(推荐:提高安全性)”,然后单击确定