vendredi 13 octobre 2017

Mink selenium2 driver doesn't work as expected

When I am using mink selenium2 driver I am unable to traverse the page. For example this chunk of code (and any other find* function) gives me an error message:

PHP Fatal error: Call to a member function getOuterHtml() on null in ...

public function test() 
{
    $this->seleniumSession->visit($this->websiteAddress);

    $page = $this->seleniumSession->getPage();

    echo $page->findById('feedback_button')->getOuterHtml();
}

On the other hand, when I am using Goutte driver session in the same chunk of code I get the HTML. (with no error message)

This is how I am creating Selenium2Driver:

    $this->seleniumDriver = new Selenium2Driver('firefox', array(
        'browserName'       => 'firefox',
        'version'           => '',
        'platform'          => 'ANY',
        'browserVersion'    => '56.0',
        'browser'           => 'firefox',
        'name'              => 'Behat Test',
        'deviceOrientation' => 'portrait',
        'deviceType'        => 'tablet',
        'selenium-version'  => '3.6.0'
    ), 'http://localhost:4444/wd/hub');

I am using selenium standalone server, version 3.6.0. I have also noticed that echo $page->getContent(); with Selenium2 Driver gives me more HTML than with Goutte driver (some additional script blocks that are not in the real web page source).

Aucun commentaire:

Enregistrer un commentaire