在Ubuntu上通过Selenium RC服务器启动Google Chrome时遇到问题

时间:2011-05-11 21:29:39

标签: google-chrome selenium selenium-rc

我在Ubuntu 11.04上运行Selenium RC服务器2.0b3。我安装了Google Chrome,并尝试对其进行一些测试。我能够很好地对Firefox运行测试。但是,当我对Selenium服务器运行我的测试时,它只是挂起然后超时。这是所有服务器日志报告(注意空会话):

16:14:16.810 INFO - Command request: getNewBrowserSession[*googlechrome, http://mydomain.com, ] on session null
16:14:16.810 INFO - creating new remote session
16:14:16.811 INFO - Allocated session 6913c9613c554db798e109eadefd43da for http://mydomain.com, launching...
16:14:16.811 INFO - Launching Google Chrome...
16:19:44.776 ERROR - Failed to start new browser session, shutdown browser and clear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window 'null' to appear
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:564)
    at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:521)
    at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:374)
    at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125)
    at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:87)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:785)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:422)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:393)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:146)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
16:19:44.777 INFO - Killing Google Chrome...
16:19:44.777 INFO - Got result: Failed to start new browser session: Error while launching browser on session null

我正在启动Selenium作为系统启动时的服务,就像这样......

start() {
    log_daemon_msg "Starting selenium-server server: "
    /usr/bin/Xvfb :15 -ac -screen 0 1024x768x8 &
    export DISPLAY=localhost:15.0
    su selenium -c 'java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > /var/log/se_rc_server.log 2>&1 &'
    PID=$!
    ### Create the lock file ###
    echo $PID > /var/run/selenium-server.pid
    echo

我有什么想法可以消除Google Chrome空会话并让我的测试运行?谢谢, - 戴夫

1 个答案:

答案 0 :(得分:0)

您正在遇到Chrome的安全限制。您需要在BrowserConfigurationOptions中将“mode”值设置为“disableSecurity”以禁用它们。

相关问题