Firefox通过GeckoDriver在Selenium 3.0.1中的.Quit()上抛出异常 [英] Firefox via GeckoDriver throws exception on .Quit() in Selenium 3.0.1

查看:429
本文介绍了Firefox通过GeckoDriver在Selenium 3.0.1中的.Quit()上抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:Firefox 50.0.2 64位,C#,Visual Studio 2015,Windows Server 2012 R2,Azure,ClearScript.V8.5.4.7,Selenium.Mozilla.Firefox.Webdriver.0.6.0.1,Selenium.WebDriver.GeckoDriver。 Win64.0.11.1



我使用ClearScript来包装用于JavaScript的Selenium对象,即

  static JScriptEngine JSengine = null; 
...
JSengine = new JScriptEngine(WindowsScriptEngineFlags.EnableDebugging | WindowsScriptEngineFlags.EnableJITDebugging);
...
JSengine.AddHostType(CSFirefoxDriver,typeof(FirefoxDriver));
JSengine.AddHostType(CSFirefoxOptions,typeof(FirefoxOptions));
JSengine.AddHostType(CSFirefoxDriverService,typeof(FirefoxDriverService));

我使用下面的JS实例化了Firefox

  var driverService = CSFirefoxDriverService.CreateDefaultService(); 
driverService.FirefoxBinaryPath =C:\\Program Files\\Mozilla Firefox\\firefox.exe;
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
var options = new CSFirefoxOptions();
driver = new CSFirefoxDriver(driverService,options,CSTimeSpan.FromSeconds(30));

匹配的Quit / Dispose代码是

  try {
driver.Quit();
catch(E){
T.Error()。Send(driver.Quit()failed。);
}

尝试{
driver.Dispose();
} catch(E){
T.Error()。Send(driver.Dispose()failed。);





$(T是一个记录对象)

执行.Quit()方法调用时,会出现以下对话框。





如果我注释掉.Quit()那么我在.Dispose()上得到了相同的结果。其他论坛建议关闭Firefox的偏好设置中的硬件加速。这完全没有任何区别。

geckodriver 关于这个声称某种修复的论坛。现在当然不是固定的。



Windows事件日志在这里并不是特别有用,即

 < Event xmlns =http://schemas.microsoft.com/win/2004/08/events/event> 
<系统>
< Provider Name =Application PopupGuid ={47BFA2B7-BD54-4FAC-B70B-29021084CA8F}/>
< EventID> 26< / EventID>
< Version> 0< / Version>
< Level> 4< / Level>
<任务> 0< /任务>
< Opcode> 0< / Opcode>
<关键字> 0x8000000000000000< / Keywords>
< TimeCreated SystemTime =2016-12-13T03:16:28.936810900Z/>
< EventRecordID> 1227958< / EventRecordID>
<关联/>
< Execution ProcessID =5856ThreadID =11580/>
< Channel>系统< / Channel>
< Computer> VM1-SQLWEB-W12< / Computer>
< Security UserID =S-1-5-18/>
< / System>
< EventData>
< Data Name =Caption> firefox.exe - 应用程序错误< / Data>
< Data Name =Message>异常断点已经达到断点。 (0x80000003)发生在应用程序位置0x880f00ef。点击OK结束程序点击CANCEL调试程序< / Data>
< / EventData>
< / Event>

我该从哪里出发?我可以回到PhantomJS,直到找到修复。

解决方案

我有同样的问题,我发现有人发布它<一个href =https://github.com/mozilla/geckodriver/issues/375 =noreferrer>这里。现在,您可以降级到Firefox 48.0.2,直到它被修复。


Context: Firefox 50.0.2 64bit, C#, Visual Studio 2015, Windows Server 2012 R2, Azure, ClearScript.V8.5.4.7, Selenium.Mozilla.Firefox.Webdriver.0.6.0.1, Selenium.WebDriver.GeckoDriver.Win64.0.11.1

I'm using ClearScript to wrap the Selenium objects for use in JavaScript, viz

    static JScriptEngine JSengine = null;
    ...
    JSengine = new JScriptEngine(WindowsScriptEngineFlags.EnableDebugging | WindowsScriptEngineFlags.EnableJITDebugging);
    ...
    JSengine.AddHostType("CSFirefoxDriver", typeof(FirefoxDriver));
    JSengine.AddHostType("CSFirefoxOptions", typeof(FirefoxOptions));
    JSengine.AddHostType("CSFirefoxDriverService", typeof(FirefoxDriverService));

I instantiate Firefox using the following JS

var driverService = CSFirefoxDriverService.CreateDefaultService();
driverService.FirefoxBinaryPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
var options = new CSFirefoxOptions();
driver = new CSFirefoxDriver(driverService, options, CSTimeSpan.FromSeconds(30));

The matching Quit/Dispose code is

try {
  driver.Quit();
} catch (E) {
  T.Error().Send("driver.Quit() failed.");
}

try {
  driver.Dispose();
} catch (E) {
  T.Error().Send("driver.Dispose() failed.");
}

(T is a logging object)

When the .Quit() method call is executed, I get the following dialog.

If I comment out the the .Quit() then I get the same on the .Dispose().

Other forums have suggested turning off hardware acceleration in Firefox's preferences. This has not made any difference at all.

There is also an issue on the geckodriver forum about this claiming a fix of some sort. It's certainly not fixed now.

Windows Event Log isn't particularly helpful here, viz

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
        <Provider Name="Application Popup" Guid="{47BFA2B7-BD54-4FAC-B70B-29021084CA8F}" /> 
        <EventID>26</EventID> 
        <Version>0</Version> 
        <Level>4</Level> 
        <Task>0</Task> 
        <Opcode>0</Opcode> 
        <Keywords>0x8000000000000000</Keywords> 
        <TimeCreated SystemTime="2016-12-13T03:16:28.936810900Z" /> 
        <EventRecordID>1227958</EventRecordID> 
        <Correlation /> 
        <Execution ProcessID="5856" ThreadID="11580" /> 
        <Channel>System</Channel> 
        <Computer>VM1-SQLWEB-W12</Computer> 
        <Security UserID="S-1-5-18" /> 
    </System>
    <EventData>
        <Data Name="Caption">firefox.exe - Application Error</Data> 
        <Data Name="Message">The exception Breakpoint A breakpoint has been reached. (0x80000003) occurred in the application at location 0x880f00ef. Click on OK to terminate the program Click on CANCEL to debug the program</Data> 
    </EventData>
</Event>

Where do I go from here? I can fall back to PhantomJS until a fix is found.

解决方案

I had the same problem, I found that someone posted it here. For now you can downgrade to Firefox 48.0.2 until it is fixed.

这篇关于Firefox通过GeckoDriver在Selenium 3.0.1中的.Quit()上抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆