Selenium 3.2.0在driver.quit()@ Win 7 Home Premium& amp; GeckoDriver 0.14.0

时间:2017-03-08 13:28:46

标签: java eclipse selenium firefox geckodriver

Win 7和FireFox以德语运行。 Win 7安装了所有可用的更新。 32位和64位GeckoDriver也一样! (我的Win 7是64位;我的FireFox是32位)。这只是我PC上的一个问题吗?

driver.quit()正在使用我的InternetExplorer而没有任何问题。

package JS_JFrame1;                                       

import org.openqa.selenium.WebDriver;                     
import org.openqa.selenium.firefox.FirefoxDriver;        

public class SeleniumFireFoxMinimal1 {  



public static void main(String[] args) throws InterruptedException {

    System.setProperty("webdriver.gecko.driver", "e:\\geckodriver.exe");

    WebDriver driver = new FirefoxDriver();                 

    driver.get("http://www.toolsqa.com");                    

    Thread.sleep(5000);                                   

    driver.quit();                                        

    }

}

像这样的其他Selenium命令运行得非常好:

element = driver.findElement(By.id("sinp"));              

System.out.println( "Element found!");                   

element.clear();                                                

element.sendKeys("black");                                      

element.submit();                                                       

Eclipse Console-Output:

  

1488978842009 addons.manager DEBUG完成启动顺序   1488978842565 Marionette INFO在港口52628上收听   1488978843470 addons.manager DEBUG启动提供程序:    1488978843470 addons.manager DEBUG注册   关闭阻止器   1488978843471 addons.manager DEBUG Provider完成启动:    1488978843514 addons.manager DEBUG开始   provider:PreviousExperimentProvider   1488978843515 addons.manager DEBUG注册关闭阻止程序   PreviousExperimentProvider 1488978843515 addons.manager DEBUG Provider   完成启动:PreviousExperimentProvider   1488978843519 DeferredSave.extensions.json DEBUG开始写   1488978843910 DeferredSave.extensions.json DEBUG写成功   1488978843910 addons.xpi-utils DEBUG XPI数据库已保存,设置   架构版本偏好为19Mär08,20172:14:06 PM   org.openqa.selenium.remote.ProtocolHandshake createSession   信息:检测到的方言:W3C 1488978859017 Marionette INFO New   将不再接受[儿童6128] ### !!!中止:   中止通道错误:文件   C:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp,   line 2143Mär08,20172:14:20 PM org.openqa.selenium.os.UnixProcess   销毁SCHWERWIEGEND:无法使用PID 4732杀死进程

FireFox-Crash-Popup的硬拷贝:

https://www.dropbox.com/s/f3cuklcsgdbqcyx/FireFox_52_CrashPopup.PNG?dl=0

GitHub报道:

https://github.com/mozilla/geckodriver/issues/517

2 个答案:

答案 0 :(得分:0)

我在Windows 10上遇到类似问题,driver.close()没有工作,driver.quit()抛出异常。

问题在于最新的geckodriver(版本0.14),请检查这些未解决的问题

答案 1 :(得分:0)

当你说你的firefox崩溃时,如果这是浏览器提供的弹出窗口 FireFox has stopped working然后以下解决方案为我工作。

  1. 转到此链接http://www.guru99.com/use-autoit-selenium.html以了解并下载Auto IT。基本上它允许您自动化Windows GUI。
  2. 您必须使用AutoIT创建一个exe文件,您将添加到您的selenium脚本以关闭弹出窗口。
  3. 请阅读以上链接,了解如何下载和打开AutoIT脚本创建器。您可以创建自己的脚本或使用下面的脚本:

    ControlFocus("火狐"""" DirectUIHWND&#34)   ControlFocus("火狐""""将Button2&#34)   ControlClick("火狐""""将Button2&#34)

  4. 编译exe并将其添加到项目中。

  5. 最后运行以下脚本,即在使用driver.quit()方法

    之后

    尝试{Runtime.getRuntime()。exec(System.getProperty(" user.dir")+    " //");} catch(IOException e){    System.out.println("无法关闭Firefox弹出");

  6. 希望这会有所帮助。