Selenium 3.6 + geckodriver 0.19.1打开空白页

时间:2017-11-08 12:23:43

标签: selenium firefox selenium-webdriver geckodriver

我的硒和geckodriver设置问题很严重。使用nunit console 3.7执行我的测试工作正常,直到某些时候,firefox窗口打开一个空白页面而没有网址。这些浏览器没有关闭,我的机器在一段时间后运行完毕(一段时间后内存不足)。

我目前的设置:

  • Selenium Server:3.6.0(适用于集线器和节点)
  • 安装Selenium WebDriver:3.6.0
  • Geckodriver:0.19.1(尝试0.19,但仍然遇到同样的问题)
  • NUnit控制台:3.7.0
  • Firefox:56.0.2(尝试过64位和32位)

我已经尝试为我的节点设置超时和browsertimeout(设置已添加到集线器中,因此所有节点都使用相同的超时)。

我无法重现错误。它只是不时发生,但如果它发生,我的执行挂起,我必须手动关闭所有的浏览器实例。如果我可以在下次捕获错误,我会尝试添加一些节点的日志。

我也尝试用新的Selenium 3.7执行我的测试,但仍然遇到了问题。

使用RemoteWebDriver执行测试:

    try{        
        var profile = new FirefoxProfile();
        profile.AcceptUntrustedCertificates = true;
        profile.AssumeUntrustedCertificateIssuer = true;

        var options = new FirefoxOptions();
        options.SetPreference("browser.startup.homepage_override.mstone", "ignore");
        options.SetPreference("startup.homepage_welcome_url.additional", "about:blank");
        options.AddAdditionalCapability("acceptInsecureCerts", true, true);
        options.Profile = profile;

        options.LogLevel = FirefoxDriverLogLevel.Trace;

        IWebDriver driver = new RemoteWebDriver(uri, options.ToCapabilities(), TimeSpan.FromSeconds(120));

        driver.Manage().Window.Minimize();
        driver.Manage().Window.Maximize();

    } catch (Exception ex){
        if(driver != null){
            driver.Quit();
        }
    }

以下是发生错误的节点的tracelog:

1510146285777   Marionette  DEBUG   Accepted connection 0 from 127.0.0.1:55114
1510146285764   geckodriver::marionette TRACE   <- {"applicationType":"gecko","marionetteProtocol":3}
1510146285764   geckodriver::marionette TRACE   -> 163:[0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1510146285782   Marionette  TRACE   0 -> [0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1510146285788   Marionette  CONFIG  Matched capabilities: {"browserName":"firefox","browserVersion":"56.0.2","platformName":"windows_nt","platformVersion":"6.1","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":60792,"moz:profile":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\rust_mozprofile.UFDwWCMRwUVv","moz:accessibilityChecks":false,"moz:headless":false}
1510146285788   Marionette  WARN    TLS certificate errors will be ignored for this session
1510146285854   Marionette  DEBUG   Register listener.js for window 4294967297
1510146285878   Marionette  TRACE   0 <- [1,1,null,{"sessionId":"3efa9020-0eda-4b77-a2f6-be368fdbb5da","capabilities":{"browserName":"firefox","browserVersion":"56.0.2","platformName":"windows_nt","platformVersion":"6.1","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":60792,"moz:profile":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\rust_mozprofile.UFDwWCMRwUVv","moz:accessibilityChecks":false,"moz:headless":false}}]
1510146285874   geckodriver::marionette TRACE   <- [1,1,null,{"sessionId":"3efa9020-0eda-4b77-a2f6-be368fdbb5da","capabilities":{"browserName":"firefox","browserVersion":"56.0.2","platformName":"windows_nt","platformVersion":"6.1","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":60792,"moz:profile":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\rust_mozprofile.UFDwWCMRwUVv","moz:accessibilityChecks":false,"moz:headless":false}}]
1510146285874   webdriver::server   DEBUG   <- 200 OK {"value": {"sessionId":"3efa9020-0eda-4b77-a2f6-be368fdbb5da","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"56.0.2","moz:accessibilityChecks":false,"moz:headless":false,"moz:processID":60792,"moz:profile":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\rust_mozprofile.UFDwWCMRwUVv","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"6.1","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
14:04:45.874 INFO - Detected dialect: W3C
14:04:45.936 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@14c39a4
14:04:45.936 INFO - Handler thread for session 3efa9020-0eda-4b77-a2f6-be368fdbb5da (firefox): Executing POST on /session/3efa9020-0eda-4b77-a2f6-be368fdbb5da/window/minimize (handler: ServicedSession)
14:04:45.936 INFO - To upstream: {}
1510146285936   webdriver::server   DEBUG   -> POST /session/3efa9020-0eda-4b77-a2f6-be368fdbb5da/window/minimize {}
1510146285936   geckodriver::marionette TRACE   -> 35:[0,2,"WebDriver:MinimizeWindow",{}]
1510146285945   Marionette  TRACE   0 -> [0,2,"WebDriver:MinimizeWindow",{}]
1510146285948   Marionette  TRACE   0 <- [1,2,null,{"x":-32000,"y":-32000,"width":160,"height":27,"state":"minimized"}]
1510146285936   geckodriver::marionette TRACE   <- [1,2,null,{"x":-32000,"y":-32000,"width":160,"height":27,"state":"minimized"}]
1510146285936   webdriver::server   DEBUG   <- 200 OK {"value": {"height":27,"width":160,"x":-32000,"y":-32000}}
14:04:45.936 INFO - To downstream: {"value": {"height":27,"width":160,"x":-32000,"y":-32000}}
14:04:45.998 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@14c39a4
14:04:45.998 INFO - Handler thread for session 3efa9020-0eda-4b77-a2f6-be368fdbb5da (firefox): Executing POST on /session/3efa9020-0eda-4b77-a2f6-be368fdbb5da/window/maximize (handler: ServicedSession)
14:04:45.998 INFO - To upstream: {}
1510146285998   webdriver::server   DEBUG   -> POST /session/3efa9020-0eda-4b77-a2f6-be368fdbb5da/window/maximize {}
1510146285998   geckodriver::marionette TRACE   -> 25:[0,3,"maximizeWindow",{}]
1510146286004   Marionette  TRACE   0 -> [0,3,"maximizeWindow",{}]
1510146286019   addons.productaddons    INFO    downloadXHR File download. status=200
1510146286022   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\ADMINI~1\AppData\Local\Temp\tmpaddon-1dfba3
1510146288810   DeferredSave.webext.sc.lz4  DEBUG   Starting write
1510146288817   DeferredSave.webext.sc.lz4  DEBUG   Write succeeded
14:05:45.349 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@5cf9f987
14:05:45.349 INFO - Handler thread for session 6f154344-8f7c-4753-8c28-403424b929bf (firefox): Executing DELETE on /session/6f154344-8f7c-4753-8c28-403424b929bf (handler: ServicedSession)
1510146345349   webdriver::server   DEBUG   -> DELETE /session/6f154344-8f7c-4753-8c28-403424b929bf 
1510146579959   addons.xpi  DEBUG   Calling bootstrap method shutdown on webcompat@mozilla.org version 1.1
1510146579960   addons.xpi  DEBUG   Calling bootstrap method shutdown on shield-recipe-client@mozilla.org version 65
1510146579960   addons.xpi  DEBUG   Calling bootstrap method shutdown on webcompat@mozilla.org version 1.1
1510146579960   addons.xpi  DEBUG   Calling bootstrap method shutdown on screenshots@mozilla.org version 10.12.0
1510146579960   addons.xpi  DEBUG   Calling bootstrap method shutdown on shield-recipe-client@mozilla.org version 65
1510146579969   addons.xpi  DEBUG   Calling bootstrap method shutdown on onboarding@mozilla.org version 0.1
1510146579961   addons.xpi  DEBUG   Calling bootstrap method shutdown on screenshots@mozilla.org version 10.12.0
1510146579969   addons.xpi  DEBUG   Calling bootstrap method shutdown on onboarding@mozilla.org version 0.1
1510146579970   addons.xpi  DEBUG   Calling bootstrap method shutdown on formautofill@mozilla.org version 1.0
1510146579970   addons.xpi  DEBUG   Calling bootstrap method shutdown on formautofill@mozilla.org version 1.0
1510146579971   addons.xpi  DEBUG   Calling bootstrap method shutdown on followonsearch@mozilla.com version 0.9.3
1510146579971   addons.xpi  DEBUG   Calling bootstrap method shutdown on firefox@getpocket.com version 1.0.5
1510146579972   addons.xpi  DEBUG   Calling bootstrap method shutdown on e10srollout@mozilla.org version 3.00
1510146579972   addons.xpi  DEBUG   Calling bootstrap method shutdown on clicktoplay-rollout@mozilla.org version 1.4
1510146579973   addons.xpi  DEBUG   Calling bootstrap method shutdown on aushelper@mozilla.org version 2.0
1510146579973   addons.xpi  DEBUG   Calling bootstrap method shutdown on activity-stream@mozilla.org version 0.0.0
1510146579970   addons.xpi  DEBUG   Calling bootstrap method shutdown on followonsearch@mozilla.com version 0.9.3
1510146579971   addons.xpi  DEBUG   Calling bootstrap method shutdown on firefox@getpocket.com version 1.0.5
1510146579971   addons.xpi  DEBUG   Calling bootstrap method shutdown on e10srollout@mozilla.org version 3.00
1510146579972   addons.xpi  DEBUG   Calling bootstrap method shutdown on clicktoplay-rollout@mozilla.org version 1.4
1510146579972   addons.xpi  DEBUG   Calling bootstrap method shutdown on aushelper@mozilla.org version 2.0
1510146579973   addons.xpi  DEBUG   Calling bootstrap method shutdown on activity-stream@mozilla.org version 0.0.0
[Parent 36360] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Parent 60792] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Parent 60792] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Parent 36360] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 47572] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 12908] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 12908] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 47572] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 26856] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1510146580071   webdriver::server   DEBUG   Deleting session
1510146580071   geckodriver::marionette DEBUG   Stopping browser process
[Child 26856] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 34436] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 34436] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1510146580108   webdriver::server   DEBUG   Deleting session
1510146580109   geckodriver::marionette DEBUG   Stopping browser process
1510146580236   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Failed to decode response from marionette","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x42361f - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
14:09:40.237 INFO - To downstream: {"value":{"error":"unknown error","message":"Failed to decode response from marionette","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x42361f - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
1510146580254   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Failed to decode response from marionette","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x42361f - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
1510146580254   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"session not created","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x422256 - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
14:09:40.254 INFO - To downstream: {"value":{"error":"session not created","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x422256 - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
14:09:40.254 INFO - To downstream: {"value":{"error":"unknown error","message":"Failed to decode response from marionette","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x42361f - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
14:09:40.255 INFO - Removing session org.openqa.selenium.remote.server.ServicedSession@5cf9f987
1510146580258   webdriver::server   DEBUG   -> DELETE /session/6f154344-8f7c-4753-8c28-403424b929bf 
1510146580259   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"session not created","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x422256 - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}
14:09:40.259 INFO - To downstream: {"value":{"error":"session not created","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n   0:   0x46c297 - <no info>\n   1:   0x422256 - <no info>\n   2:   0x406389 - <no info>\n   3:   0x40cc97 - <no info>\n   4:   0x657a89 - <no info>\n   5:   0x4185b6 - <no info>\n   6:   0x6535a1 - <no info>\n   7: 0x76c3336a - BaseThreadInitThunk\n   8: 0x77e79902 - RtlInitializeExceptionChain"}}

在窗口被卡住之前调用的最后一行应该是这样的:

1510146345349   webdriver::server   DEBUG   -> DELETE /session/6f154344-8f7c-4753-8c28-403424b929bf 

在我手动关闭浏览器实例后创建上面一行之后写的所有其他日志行。

0 个答案:

没有答案