会话过期/超时并抛出“会话ID为空”。调用quit()异常后使用WebDriver

时间:2018-07-19 13:52:28

标签: selenium selenium-webdriver automation selenium-firefoxdriver geckodriver

会话仅在测试过程中失败:

StackTrace:

1532007067797   Marionette  TRACE   0 -> [0,53,"WebDriver:ExecuteScript",{"args":[{"ELEMENT":"297d9b77-2267-4509-ba4c-d61f70b59df3","element-6066-11e4-a52e-4f735466ce ... a4c-d61f70b59df3"}],"newSandbox":false,"script":"arguments[0].scrollIntoView();","scriptTimeout":null,"specialPowers":false}]
1532007067809   Marionette  TRACE   0 <- [1,53,null,{"value":null}]
1532007067822   webdriver::server   DEBUG   <- 200 OK {"value":null}
1532007067837   webdriver::server   DEBUG   -> POST /session/cdb1f349-4f61-4584-b75e-66ef4a48ad3f/element/297d9b77-2267-4509-ba4c-d61f70b59df3/click {
  "id": "297d9b77-2267-4509-ba4c-d61f70b59df3"
}
1532007067832   Marionette  TRACE   0 -> [0,54,"WebDriver:ElementClick",{"id":"297d9b77-2267-4509-ba4c-d61f70b59df3"}]
1532007068072   Marionette  DEBUG   Canceled page load listener because no navigation has been detected
1532007068074   Marionette  TRACE   0 <- [1,54,null,{}]
1532007068087   webdriver::server   DEBUG   <- 200 OK {"value": null}
1532007068102   webdriver::server   DEBUG   -> POST /session/cdb1f349-4f61-4584-b75e-66ef4a48ad3f/frame {
  "id": null
}
1532007068092   Marionette  TRACE   0 -> [0,55,"WebDriver:SwitchToFrame",{}]
1532007068095   Marionette  TRACE   0 <- [1,55,null,{}]
1532007068102   webdriver::server   DEBUG   <- 200 OK {"value": null}
org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z'
System info: host: 'VPC010037117046', ip: '10.37.117.46', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_162'
Driver info: driver.version: EventFiringWebDriver
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:125)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
    at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:294)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
    at com.sun.proxy.$Proxy10.getScreenshotAs(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver.getScreenshotAs(EventFiringWebDriver.java:302)
    at CommonUtils.TestUtil.captureScreenshot(TestUtil.java:90)
    at CommonUtils.TestUtil.executeStep(TestUtil.java:146)
    at Tests.TC08_Add_Diff_Phone_Type_Send_Deployment_Mails.executeTest(TC08_Add_Diff_Phone_Type_Send_Deployment_Mails.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at AutomationLauncher.ExecutionController.testApp(ExecutionController.java:238)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:580)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
1532007068134   webdriver::server   DEBUG   -> DELETE /session/cdb1f349-4f61-4584-b75e-66ef4a48ad3f 
1532007068123   Marionette  TRACE   0 -> [0,56,"Marionette:Quit",{"flags":["eForceQuit"]}]
1532007068125   Marionette  DEBUG   New connections will no longer be accepted
1532007068235   Marionette  TRACE   0 <- [1,56,null,{"cause":"shutdown"}]
1532007068290   webdriver::server   DEBUG   Deleting session
1532007068293   Marionette  TRACE   0 -> [0,57,"Marionette:Quit",{"flags":["eForceQuit"]}]
1532007068294   Marionette  TRACE   0 <- [1,57,{"error":"invalid session id","message":"","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178:5\nInv ... et@chrome://marionette/content/server.js:241:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:500:9\n"},null]

在测试的那部分,我没有退出或关闭驱动程序,但仍然遇到此问题。但是,我确实将驾驶员带入不同的班级(我不确定这是否是一个问题)。另外要注意的是,在异常处理需要一点时间之前,我曾尝试执行此选项。会话可能会超时吗?我已将隐式等待声明为30秒。我需要声明更多超时吗?你能帮忙吗?

版本:

3.13.0 Firefox 60.0.1 壁虎驱动程序:0.21.0

0 个答案:

没有答案