2017-08-25 40 views
1

我想從硒切換到aerokube/selenoid。 硒下面的設置工作:無法打開連接:未定義索引:狀態(selenoid,behat,水貂)

version: '2.1' 
services: 

    hub: 
    image: selenium/hub:2.53.0 
    ports: 
     - "4444:4444" 
    networks: 
     - default 

    browser0: 
    image: selenium/node-firefox-debug:2.53.0 
    ports: 
     - "5555" 
    environment: 
     SE_OPTS: '-log $PWD/logs/selenium-logs' 
    networks: 
     - default 
    depends_on: 
     - hub 
    environment: 
     - HUB_PORT_4444_TCP_ADDR=hub 
     - HUB_PORT_4444_TCP_PORT=4444 
     - no_proxy=localhost 

我嘗試以下selenoid設置:

version: '3' 
services: 

    selenoid: 
    image: selenoid/vnc:firefox_53.0 
    network_mode: bridge 
    ports: 
     - "4444:4444" 
    volumes: 
     - ".:/etc/selenoid" 
     - "/var/run/docker.sock:/var/run/docker.sock" 

    selenoid-ui: 
    image: aerokube/selenoid-ui 
    network_mode: bridge 
    links: 
     - selenoid 
    ports: 
     - "8080:8080" 
    command: ["--selenoid-uri", "http://selenoid:4444"] 

它失敗Could not open connection: Notice: Undefined index: status in /ProjectPath/vendor/instaclick/php-webdriver/lib/WebDriver/AbstractWebDriver.php line 139 (Behat\Mink\Exception\DriverException)

的源代碼有以下幾點:

// if not success, throw exception 
    if ((int) $result['status'] !== 0) { 
     throw WebDriverException::factory($result['status'], $message); 
    } 

當我var_dump($result);die;

array(1) { ["value"]=> array(2) { 
    ["sessionId"]=> 
    string(36) "20c829fa-7f73-45a5-b440-8a3282b4feea" 
    ["capabilities"]=> 
    array(12) { 
     ["acceptInsecureCerts"]=> 
     bool(false) 
     ["browserName"]=> 
     string(7) "firefox" 
     ["browserVersion"]=> 
     string(6) "55.0.1" 
     ["moz:accessibilityChecks"]=> 
     bool(false) 
     ["moz:processID"]=> 
     int(35) 
     ["moz:profile"]=> 
     string(33) "/tmp/rust_mozprofile.BdIIDrRL7KKu" 
     ["pageLoadStrategy"]=> 
     string(6) "normal" 
     ["platformName"]=> 
     string(5) "linux" 
     ["platformVersion"]=> 
     string(14) "3.16.0-4-amd64" 
     ["rotatable"]=> 
     bool(false) 
     ["specificationLevel"]=> 
     int(0) 
     ["timeouts"]=> 
     array(3) { 
     ["implicit"]=> 
     int(0) 
     ["pageLoad"]=> 
     int(300000) 
     ["script"]=> 
     int(30000) 
     } 
    } } } 

所以它做了一些事情。
不知道是什麼問題,任何幫助,將不勝感激。

我的狗愛吃,走出門外,你也是嗎?你如何找到stackoverflow竟然是如此限制,我必須編寫除代碼之外的其他東西,這是什麼?

+0

所以你的意圖是讓我想起一個網格?這裏提供的'selenoid'是什麼,你不能直接在網格中做? –

+0

我希望selenoid會更快。我認爲值得一試,不幸的是,它的工作,需要更長的時間;) – metanerd

回答

1

此錯誤應該只能用最新的Firefox版本重現(例如:53.0,54.055.0) - 其餘所有應該工作。這是因爲這些版本的瀏覽器圖像使用的是直接代理Geckodriver,它遵循W3C Selenium協議specification,從release 0.16.0開始。本規範與之前支持的Selenium版本有一點不同的JSON交換格式。所以爲了解決這個問題你只需要將你的PHP Selenium客戶端升級到支持新格式的最新版本。不確定混凝土版本,但例如對於Java,它應該從版本3.4.0開始工作。