Selenium 3.0.1在driver.quit()期间使FireFox 51.0.1崩溃@Win 7 Home Premium&;壁虎河0.13.0

Selenium 3.0.1在driver.quit()期间使FireFox 51.0.1崩溃@Win 7 Home Premium&;壁虎河0.13.0,selenium,firefox,geckodriver,Selenium,Firefox,Geckodriver,Win 7和FireFox以德语运行。 Win 7已安装所有可用更新 32位和64位GeckoDriver也一样!(我的Win7是64位;我的FireFox是32位) GeckoDriver 0.14也一样 这只是我电脑上的问题吗 driver.quit()正在使用我的InternetExplorer,没有问题 package JS_JFrame1; import org.openqa.selenium.WebDri

Win 7和FireFox以德语运行。
Win 7已安装所有可用更新

32位和64位GeckoDriver也一样!(我的Win7是64位;我的FireFox是32位)

GeckoDriver 0.14也一样

这只是我电脑上的问题吗

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控制台输出:

1485978825934 geckodriver信息监听127.0.0.1:21352 2001年2月, 2017年8:53:46 PM org.openqa.selenium.remote.ProtocolHandshake createSession信息:正在尝试双方言会话,假设 波斯特尔定律在遥远的一端是正确的 1485978826606 mozprofile::使用配置文件路径的配置文件信息 C:\Users\xxxxxxx\AppData\Local\Temp\rust_mozprofile.qNYZq4KKbeGl 1485978826606 geckodriver::木偶信息启动浏览器C:\Program 文件(x86)\Mozilla Firefox\Firefox.exe 1485978826637 geckodriver::木偶信息连接到上的木偶 本地主机:51926 1485978828021在端口51926上侦听木偶信息 2017年2月1日8:53:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession信息:检测到的方言:W3C JavaScript警告: ,行 664:错误:WebGL:getParameter:参数:无效的枚举值[Child 4416]####!!!中止:在通道上中止错误。:file c:/builds/moz2_slave/m-rel-w32-00000000000000/build/src/ipc/glue/MessageChannel.cpp, 第2056行2017年2月1日8:54:07 PM org.openqa.selenium.os.UnixProcess 销毁SCHWERWIEGEND:无法使用PID 4608终止进程


这是已知的Firefox/geckodriver退出驱动程序的问题,有关详细信息,请参阅


它出现在一些FF版本中,有人说它是固定的,有人说它不是。我找不到更好的解决方案,所以我打开了“旧”Firefoxdriver和FF v47.0.2,这两个版本运行良好。

browser.tabs.remote.autostart.2
设置为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);

我找到了解决办法。我的代码是C#


希望它能帮助您。

这个问题与firefox从firefox版本>=50开始使用多进程环境有关,selenium似乎无法处理这个问题

添加以下行可以解决此问题:

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

重新启动计算机后是否尝试运行?是的,Jeroen,在3天内运行20次。请改用firefox 50。它应该在about:config中有两个这样的autostart条目,一个有扩展名2,一个没有扩展名。我现在将两个条目都设置为false,但它没有改变任何内容。FireFox仍然是Chrash(当然我重新启动了FireFox)。其他6行代码呢?我的JavaSeleniumSnip中也需要它们吗?非常感谢。
FirefoxProfile ffProfile = new FirefoxProfile();
ffProfile.setPreference("browser.tabs.remote.autostart.2", false);
WebDriver driver = new FirefoxDriver(newFirefoxOptions().setProfile(ffProfile));