Selenium 3.12在driver.quit()上显示错误@ FireFox 60 / Win 7 Home Premium / Java 10.0.1 / GeckoDriver 0.20.1

时间:2018-05-12 11:39:30

标签: java selenium firefox selenium-webdriver geckodriver

我的电脑:

赢7/64位 - 安装所有更新
FireFox 60.0 / 64位
Java 10.0.1
硒3.12
Geckodriver 0.20.1 / 64位
Eclipse 4.7.3a

JAVA-源码:

public class SeleniumFireFoxMinimal1 {                                                             
    public static void main(String[] args) throws InterruptedException {                           
        System.setProperty("webdriver.gecko.driver", "e:\\geckodriverwrapper.bat");                       
        WebDriver driver = new FirefoxDriver();                 
        driver.get("http://www.toolsqa.com");                                                      
        driver.quit();                                                                             
    }                                                                                              
}

geckodriverwrapper.bat:

@ECHO OFF  
ECHO Starting geckodriver: %0 %*  
E:\geckodriver.exe --log trace %* > NUL 2>&1  

Eclipse控制台输出:

Starting geckodriver: E:\geckodriverwrapper.bat --port=27751 -b "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Mai 12, 2018 1:14:15 VORM. org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMATION: Detected dialect: W3C

Firefox窗口关闭后15秒显示以下行:

Mai 12, 2018 1:14:37 VORM. org.openqa.selenium.os.OsProcess destroy
INFORMATION: Unable to drain process streams. Ignoring but the exception being swallowed follows.
org.apache.commons.exec.ExecuteException: The stop timeout of 2000 ms was exceeded (Exit value: -559038737)
    at org.apache.commons.exec.PumpStreamHandler.stopThread(PumpStreamHandler.java:295)
    at org.apache.commons.exec.PumpStreamHandler.stop(PumpStreamHandler.java:181)
    at org.openqa.selenium.os.OsProcess.destroy(OsProcess.java:135)
    at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:153)
    at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:222)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:95)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
    at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:443)
    at at.xxxxxxx.work.SeleniumFireFoxMinimal1.main(SeleniumFireFoxMinimal1.java:40)
Mai 12, 2018 1:14:37 VORM. org.openqa.selenium.os.OsProcess destroy
SCHWERWIEGEND: Unable to kill process Process[pid=4320, exitValue=1]

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

element = driver.findElement(By.id("sinp"));              
element.clear();                                                
element.sendKeys("black");                                      
element.submit();                                                                                                                                                           

这只是我的电脑上的一个问题吗?

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

也许我们必须重新打开这个问题?:

https://github.com/SeleniumHQ/selenium/issues/4678

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

https://bugzilla.mozilla.org/show_bug.cgi?id=1401109

现在(2018年5月15日)我也在这里发布了

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

1 个答案:

答案 0 :(得分:1)

我没有干净的解决方案,但是有一种解决方法:我将driver.quit()更改为driver.close()。 通常用于关闭窗口。但是,如果这是最后一个窗口,它将起作用。经过

测试
  • geckodriver 0.18.0
  • Java 1.8.0_65
  • Raspbian GNU / Linux 8(Jessie)
  • 硒3.14.0
  • Firefox 52.9.0