【发布时间】:2015-05-30 03:36:03
【问题描述】:
在运行我的测试时,我需要有很长的延迟(约 40 秒)。
我知道,Selenium 会话在那段时间被删除了。
请帮助:如何配置会话超时以增加?
在 Selenium 节点日志中开始延迟后,我在 30 秒内看到的内容:
INFO org.openqa.selenium.remote.server.DriverServlet - 会话 7f5ffec-4882-4c4c-b091-c780c66d379d 因客户端超时而被删除
睡眠 40 秒后,我的代码中出现了这个异常:
org.openqa.selenium.remote.SessionNotFoundException
我尝试增加所有可能的超时时间。 以下是我启动集线器的方式:
java -jar selenium-server-standalone.jar -role hub
-hubConfig selenium_hub.json
-nodeTimeout 61
-remoteControlPollingIntervalInSeconds 180
-sessionMaxIdleTimeInSeconds 240
-newSessionMaxWaitTimeInSeconds 250
-timeout 59
这里是 selenium_hub.json:
{
"host": null,
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets": [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 60000,
"browserTimeout": 60000,
"maxSession": 5,
"jettyMaxThreads": -1
}
节点上没有配置任何超时。 这是我在 Grid 控制台中看到的内容:
browserTimeout : 60000
capabilityMatcher : org.openqa.grid.internal.utils.DefaultCapabilityMatcher
cleanUpCycle : 5000
host : null
hubConfig : /usr/local/selenium/config/selenium_hub.json
jettyMaxThreads : -1
maxSession : 5
newSessionMaxWaitTimeInSeconds : 250
newSessionWaitTimeout : -1
nodePolling : 5000
nodeTimeout : 61
port : 4444
prioritizer : null
remoteControlPollingIntervalInSeconds : 180
role : hub
servlets : []
sessionMaxIdleTimeInSeconds : 240
throwOnCapabilityNotPresent : true
timeout : 59000
我正在使用 Selenium 2.45
【问题讨论】:
-
您好,请问您是如何找到所有这些参数的?我看不到文档中提到的很多。谢谢!
-
好问题。我不认为这是有据可查的。我刚刚使用了 Selenium 的默认文件:github.com/SeleniumHQ/selenium/tree/master/java/server/src/org/…
标签: selenium selenium-webdriver session-timeout selenium-grid