2017-06-15 71 views
0

我想在Symfony2和Selenium(獨立服務器)上使用Behat。Symfony/Behat不使用wd_driver

配置我behat.yml

behat.yml

default: 
    formatters: 
     pretty: 
      verbose: true 
    extensions: 
     Behat\Symfony2Extension: 
      #screenshot_directory: /tmp/screenshot 

     Behat\MinkExtension: 
      base_url: 'http://localhost/app_test.php' 
      selenium2: 
       wd_host: "http://192.168.33.1:6666/wd/hub" 
      browser_name: googlechrome 
      show_auto: false 
      sessions: 
       default: 
        symfony2: ~ 
       javascript: 
        selenium2: ~ 
    suites: 
     default: 
      paths: 
       - '%paths.base%/tests/behat/features' 
      contexts: 
       - FeatureContext 

我開始貝哈特用命令

bin/behat --no-interaction --config /var/www/myproject/behat.yml /var/www/myproject/tests/behat/features/scenario/demo.feature 

我有一個錯誤信息:

Could not open connection: Curl error thrown for http POST to http://localhost:4444/wd/hub/session 

爲什麼behat不使用wd _host在我的配置?我錯過了什麼?

回答

2

因爲你重新聲明它吼叫在線

javascript: 
    selenium2: ~ 

爲了解決這個問題 - 在javascript部分

default: 
    formatters: 
     pretty: 
      verbose: true 
    extensions: 
     Behat\Symfony2Extension: 
      #screenshot_directory: /tmp/screenshot 

     Behat\MinkExtension: 
      base_url: 'http://localhost/app_test.php' 
      browser_name: googlechrome 
      show_auto: false 
      sessions: 
       default: 
        symfony2: ~ 
       javascript: 
        selenium2: 
         wd_host: "http://192.168.33.1:6666/wd/hub" 
    suites: 
     default: 
      paths: 
       - '%paths.base%/tests/behat/features' 
      contexts: 
       - FeatureContext 
+0

完美的移動你的網址!感謝您的解釋:) – Sancho

+0

歡迎您! –