Selenium 3.0.1 crashes FireFox 51.0.1 during driver.quit() @ Win 7 Home Premium & GeckoDriver 0.13.0

两盒软妹~` 提交于 2019-12-23 02:20:16

问题


Win 7 and FireFox is running in German language.
Win 7 has all available updates installed.

Same for 32 and 64 Bit GeckoDriver! (my Win 7 ist 64 Bit; my FireFox is 32 Bit).

Same for GeckoDriver 0.14.

Is this just a problem on my PC ?

driver.quit() is working on my InternetExplorer without a problem.

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();                                        

}                                                            

}                                                                    

Other selenium commands like these work perfectly well:

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

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

    element.clear();                                                

    element.sendKeys("black");                                      

    element.submit();                                                       

Eclipse Console-Output:

1485978825934 geckodriver INFO Listening on 127.0.0.1:21352 Feb 01, 2017 8:53:46 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFORMATION: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end 1485978826606 mozprofile::profile INFO Using profile path C:\Users\xxxxxxx\AppData\Local\Temp\rust_mozprofile.qNYZq4KKbeGl 1485978826606 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe 1485978826637 geckodriver::marionette INFO Connecting to Marionette on localhost:51926 1485978828021 Marionette INFO Listening on port 51926 Feb 01, 2017 8:53:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFORMATION: Detected dialect: W3C JavaScript warning: https://www.youtube.com/yts/jsbin/player-de_DE-vflWB2cvt/base.js, line 664: Error: WebGL: getParameter: parameter: invalid enum value [Child 4416] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2056 Feb 01, 2017 8:54:07 PM org.openqa.selenium.os.UnixProcess destroy SCHWERWIEGEND: Unable to kill process with PID 4608


回答1:


set browser.tabs.remote.autostart.2 to false.

FirefoxOptions options = new FirefoxOptions();
options.BrowserExecutableLocation = Settings.Default.FirefoxBinary;

>>>> profile.SetPreference("browser.tabs.remote.autostart.2", false);
FirefoxProfile profile = new FirefoxProfile();
....
options.Profile = profile;
driverSet.Driver = new FirefoxDriver(options);



回答2:


The issue is related to the fact firefox started using multiprocess environment from firefox version >= 50, and it seems selenium is unable to handle it.

Adding the following lines should resolve this issue :

FirefoxProfile ffProfile = new FirefoxProfile();
ffProfile.setPreference("browser.tabs.remote.autostart.2", false);
WebDriver driver = new FirefoxDriver(newFirefoxOptions().setProfile(ffProfile));



回答3:


It's a known Firefox/geckodriver issue with quitting driver, see here for more details.

It appears in some FF versions, some say it's fixed, some say it's not. I couldn't find better solution for this so I switched on 'old' Firefoxdriver and FF v47.0.2 which works fine.




回答4:


I found a workaround for this. My code is in C#

Utility.Instance.KillProcess("firefox");
System.Windows.Forms.SendKeys.SendWait("{ESC}");
Utility.Instance.KillProcess("geckodriverserver");

Hope it will help you.



来源:https://stackoverflow.com/questions/41989087/selenium-3-0-1-crashes-firefox-51-0-1-during-driver-quit-win-7-home-premium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!