mercredi 18 juillet 2018

Running behat tests with selenium2 driver

I'm new to behat and php. I want to run some tests using behat, selenium grid and Selenium2 driver and I have some issues. I am trying to start session like this:

$mink = new Mink([
                'selenium2' => new \Behat\Mink\Session(
                    new Selenium2Driver('chrome', null, 'http://172.28.128.11:4444/wd/hub'))
            ]);

            $this->gui = $mink->getSession('selenium2');

and then visit page:

$this->gui->visit("url");

My behat configuration looks like this:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        #- Behat\MinkExtension\Context\MinkContext
  extensions:
    Behat\MinkExtension:
      base_url: url
      browser_name: chrome
      default_session: goutte
      javascript_session: selenium2
      goutte: ~
      # https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
      selenium2:
        browser: chrome
        wd_host: 'http://172.28.128.11:4444/wd/hub'
        capabilities: { browser: chrome, browserVersion: 66.0.3359.117, version: 66.0.3359.117}

and I am still getting an error:

"Could not open connection: Error forwarding the new session cannot find : Capabilities {browser: firefox, browserName: chrome, browserVersion: 9, deviceOrientation: portrait, deviceType: tablet, name: Behat Test, selenium-version: 2.31.0, version: 9}"

Can someone help? :)

Aucun commentaire:

Enregistrer un commentaire