Selenium selenium3+firefox47 退出浏览器问题

辰小诺 · 2017年01月12日 · 最后由 JoJo 回复于 2017年02月07日 · 1576 次阅读

测试代码如下:

File classPathRoot = new File(System.getProperty("user.dir"));  
System.setProperty("webdriver.gecko.driver", classPathRoot+"\\driver\\firefox\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.baidu.com");
driver.manage().window().maximize();

当使用 close() 方法时,无反应,当使用 quit() 时出现如下错误:
[NPAPI 5648] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2027
一月 12, 2017 11:36:09 上午 org.openqa.selenium.os.UnixProcess destroy
严重: Unable to kill process with PID 11340

共收到 6 条回复 时间 点赞

Geckodriver 好像只支持 ff 48 以上

#1 楼 @jinjun0620 我试了 49 的也有这个错😒

系统属性名称改下。
System.setProperty("webdriver.firefox.marionette",classPathRoot+"\driver\firefox\geckodriver.exe");

#3 楼 @tina_yf117 试了下你说的改法,报错了。。。

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

#4 楼 @ht System.setProperty("webdriver.firefox.marionette","D:/.../Mozilla Firefox/geckodriver.exe");
System.setProperty("webdriver.firefox.bin","D:/.../Mozilla Firefox/firefox.exe");

可以把 geckodriver.exe 的路径配置到系统变量中试试

我建议用 selenium Firefox 最好用 Firefox ESR 版本 42 周更新一次 比较稳定 不会有任何问题

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册