代码之家  ›  专栏  ›  技术社区  ›  Geoff Maddock

Selenium服务器与Chrome使用Codeception RunProcess问题

  •  0
  • Geoff Maddock  · 技术社区  · 6 年前

    我正在考虑使用Selenium服务器和Chrome来使用Codeception框架进行浏览器验收测试。在Windows10计算机上本地工作。

    我的验收.suite.yml:

    actor: AcceptanceTester
    
    extensions:
        enabled:
            - Codeception\Extension\RunProcess:
                - php -S 127.0.0.1:4444
                - java -jar selenium-server-standalone-3.14.0.jar
    
    modules:
        enabled:
            - WebDriver:
                url: 'http://mysite.dev/'
                browser: chrome
                host: localhost
                port: 4444
                window_size: 1024x768
                restart: true
            - Asserts
            - \Helper\AcceptanceInternal
    

    从命令行运行测试时,它会启动selenium,但测试失败并出现以下错误:

    AcceptanceInternal Tests (12) ------------------------------
    
      [RunProcess] Starting php -S 127.0.0.1:4444
      [RunProcess] Starting java -jar selenium-server-standalone-3.14.0.jar
    1) ProductControllerCest: Cannot view index without logging in
     Test  tests/acceptanceInternal/Controller/Internal/ProductControllerCest.php:notLoggedInIndex
    
    
    
      [Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
    Error code: 4
    The response: '\<!doctype html>\<html>\<head>\<title>404 Not Found\</title>\<style>
    body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; }
    h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; }
    h1, p { padding-left: 10px; }
    code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;}
    \</style>
    \</head>\<body>\<h1>Not Found\</h1>\<p>The requested resource \<code class="url">/wd/hub/session\</code> was not found on this server.\</p>\</body>\</html>'
    

    但是,如果我在浏览器中访问,我会看到selenium: http://localhost:4444/wd/hub/static/resource/hub.html

    对这里可能出现的问题有什么建议吗?

    0 回复  |  直到 6 年前