JulienBlc
JulienBlc

Reputation: 134

"could not open connection" behat and selenium

I have a problème and really don't know where it comes from. I'm using behat, selenium and goutte to do tests.

My behat.yml :

    default:
  paths:
    features: features
    bootstrap: %behat.paths.features%/bootstrap
  extensions:
    Behat\MinkExtension\Extension:
      goutte: ~
      selenium2: ~

I have a simple scenario :

  @javascript
  Scenario: Searching for "test"
    Given I go to "https://www.google.fr"
    When I fill in "q" with "test"
    And I press "btnG"
    Then I should see "speedtest"

When I run it, my firefox browser is opening, but nothing happen. Here is the result :

  @javascript
  Scenario: Searching for "test"          # features/test.feature:7
    Given I go to "https://www.google.fr" # FeatureContext::visit()
      Could not open connection
    When I fill in "q" with "test"        # FeatureContext::fillField()
    And I press "btnG"                    # FeatureContext::pressButton()
    Then I should see "speedtest"

It's weird because when i remove the "javascript", everything run normally. So I think my problem comes from firefox. Moreover, the firefox browser which is opened is not the "normal" browser (the characteres are smallers).

Can you help me please ? :)

Upvotes: 0

Views: 1514

Answers (1)

BentCoder
BentCoder

Reputation: 12740

I had weird problems with Firefox and swithed to Chrome which solved my problems. You need to download Chrome driver.

behat.yml

default:
    context:
        class: 'FeatureContext'
    extensions:
        Behat\Symfony2Extension\Extension:
            mink_driver: true
            kernel:
                env: test
                debug: true
        Behat\MinkExtension\Extension:
            base_url: 'http://localhost/local/sport/web/app_test.php/'
            browser_name: 'chrome'
            goutte: ~
            selenium2: ~
    paths:
        features: 'src/Football/TeamBundle/Features'
        bootstrap: %behat.paths.features%/Context

I'm usign these packages:

"require-dev": {
    "behat/behat": "2.5.*@stable",
    "behat/behat-bundle": "1.0.0",
    "behat/symfony2-extension": "1.1.2",
    "behat/mink": "1.5.0",
    "behat/mink-extension": "~1.3",
    "behat/mink-selenium2-driver": "1.1.1",
    "behat/mink-goutte-driver": "1.0.9",
    "phing/phing": "2.8.2"
},

Working Feature:

Feature: I say hello

@javascript
Scenario: I say hello here
When I go to '/'
Then I fill in "text_hello" with "Hello"

Upvotes: 1

Related Questions