我目前正在尝试使用selenium的chromedriver在Amazon EC2服务器上启动一些Node实例进行一些测试。理想情况下,我希望达到运行Chrome的1000多个节点实例,但这就是问题开始的地方。
启动84个节点实例后,selenium拒绝再启动任何节点&我刚收到超时错误。 我认为它可能是一个ulimit问题,但改变ulimit -n并没有什么区别。 我也尝试在新的不同的EC2实例上设置这一切但在这里也没有运气。
我使用webdriverio的javascript绑定与selenium-standalone结合运行chrome无头实例。 RAM不应该是一个问题,因为我使用的EC2服务器每个都有100GB + RAM。
现在已经处理了这个问题大约一周了,所以任何建议都会有所帮助!!
客户端错误:
RuntimeError: RuntimeError
(UnknownError:13) An unknown server-side error occurred while processing the command.
Problem: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.12.301324 (de8ab311bc9374d0ade71f7c167bad61848c7c48),
platform=Linux 3.2.0-60-virtual x86_64) (WARNING: The server did not provide any
stacktrace information)
Command duration or timeout: 60.56 seconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'ip-172-31-25-40', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64',
os.version: '3.2.0-60-virtual', java.version: '1.7.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Callstack:
-> init()
以下是selenium服务器端的完整错误输出:
20:32:19.818 WARN - Exception thrown java.util.concurrent.ExecutionException:
org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'ip-172-31-25-40', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64',
os.version: '3.2.0-60-virtual', java.version: '1.7.0_65'
Driver info: driver.version: unknown
.
.
.
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'ip-172-31-25-40', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64',
os.version: '3.2.0-60-virtual', java.version: '1.7.0_65'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(
DefaultDriverProvider.java:69)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(
DefaultDriverProvider.java:53)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(
DefaultDriverFactory.java:54)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:214)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(
DefaultDriverProvider.java:59)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start:
exited abnormally
(Driver info: chromedriver=2.12.301324 (de8ab311bc9374d0ade71f7c167bad61848c7c48),
platform=Linux 3.2.0-60-virtual x86_64) (WARNING: The server did not provide any \
stacktrace information)
Command duration or timeout: 60.54 seconds
节点实例代码:
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome',
version: 38
},
port: 4444 // same port as the one used by the selenium-start server
};
var url = "example.com";
var seconds = 3600;
webdriverio
.remote(options)
.init()
.url(url)
.pause(seconds * 1000)
.end();