Symfony/Behat 不使用 wd_driver

Symfony/Behat doesn't use wd_driver

我想将 Behat 与 Symfony2 和 Selenium(独立服务器)一起使用。

我配置我的 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?我错过了什么?

因为您在下面的行中重新声明了它

javascript:
    selenium2: ~

要解决这个问题 - 将您的 url 移到 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