简体   繁体   中英

Symfony/Behat doesn't use wd_driver

I want to use Behat with Symfony2 and Selenium (standalone server).

I configure my 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

I start behat with the command

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

I have an error message:

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

Why behat doesn't use the wd_host in my configuration ? What i missed ?

Because you redeclare it bellow on line

javascript:
    selenium2: ~

To fix that - move your url under javascript section

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM