【问题标题】:Symfony/Behat doesn't use wd_driverSymfony/Behat 不使用 wd_driver
【发布时间】:2017-06-15 13:12:05
【问题描述】:

我想将 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

为什么不在我的配置中使用 wd_host ?我错过了什么?

【问题讨论】:

    标签: symfony selenium behat


    【解决方案1】:

    因为你在网上重新声明了它

    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
    

    【讨论】:

    • 完美!!谢谢你的解释:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-11
    • 2017-03-29
    • 1970-01-01
    • 2017-02-10
    相关资源
    最近更新 更多