giorgiosironi / phpunit-selenium

Selenium RC integration for PHPUnit
http://www.phpunit.de/
Other
602 stars 271 forks source link

driver.php throwing an error #406

Closed wtangren closed 4 years ago

wtangren commented 7 years ago

I am trying to use the latest phpunit-selenium with selenium standalone server 3.0.1, phpunit 5.7.13, firefox 51.0.1, and java 1.8.0_121 on a Fedora 24 VM. When run a simple test case:

require_once('/usr/local/bin/composer/vendor/autoload.php'); class test extends PHPUnit_Extensions_Selenium2TestCase { protected function setUp() { $this->setBrowser("*firefox"); $this->setBrowserUrl("https://fakeurl.com/"); } public function testMyTestCase() { $this->open("/"); } }

I get these errors:

PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The best matching driver provider Firefox/Marionette driver can't create a new driver instance for Capabilities [{browserName=*firefox}] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.10-100.fc24.x86_64', java.version: '1.8.0_121' Driver info: driver.version: unknown

/usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:165 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:72 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php:67 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:296 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:337 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:314

selenium server throws similar errors. I've installed geckodriver (i.e Marionette) and made sure everything is in the PATH. I can't figure out why this is failing. Can you provide any pointers?

wtangren commented 7 years ago

I've also used the setBrowser command to use older versions of firefox (41 and 45). It didn't make any difference.

rbkoms commented 7 years ago

can u try with this code , adding www $this->setBrowserUrl('http://www.example.com/');

On 28 February 2017 at 02:06, wtangren notifications@github.com wrote:

I've also used the setBrowser command to use older versions of firefox (41 and 45). It didn't make any difference.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/giorgiosironi/phpunit-selenium/issues/406#issuecomment-282841295, or mute the thread https://github.com/notifications/unsubscribe-auth/AE9G9-j_vQHp_-tYDBGh_BAWglFu3uYKks5rgzBfgaJpZM4MNfsT .

wtangren commented 7 years ago

The URL doesn't make any difference. It doesn't get that far before it fails.

rbkoms commented 7 years ago

give a test with the firefox version 20-25

On 28 February 2017 at 19:30, wtangren notifications@github.com wrote:

The URL doesn't make any difference. It doesn't get that far before it fails.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/giorgiosironi/phpunit-selenium/issues/406#issuecomment-283042454, or mute the thread https://github.com/notifications/unsubscribe-auth/AE9G9zf_pZT9GkgdzIi5_aCsZ6Wk9ftnks5rhCTegaJpZM4MNfsT .

wtangren commented 7 years ago

I installed FF24. I changed one line above:

  $this->setBrowser("/usr/local/bin/ff24/firefox/firefox-bin");

I reran the test: [bjt@localhost projects]$ /usr/local/bin/phpunit/phpunit-5.7.14.phar -vvv test.php PHP Warning: Declaration of PHPUnit_Extensions_Selenium2TestCase::onNotSuccessfulTest(Exception $e) should be compatible with PHPUnit_Framework_TestCase::onNotSuccessfulTest($e) in /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php on line 510 PHPUnit 5.7.14 by Sebastian Bergmann and contributors.

Runtime: PHP 7.0.16 E 1 / 1 (100%) Time: 168 ms, Memory: 10.00MB

There was 1 error:

1) test::testMyTestCase PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The best matching driver provider Firefox/Marionette driver can't create a new driver instance for Capabilities [{browserName=/usr/local/bin/ff24/firefox/firefox-bin}] Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800' System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.6-300.fc25.x86_64', java.version: '1.8.0_121' Driver info: driver.version: unknown org.openqa.selenium.WebDriverException

/usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:147 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:71 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php:67 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:246 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:287 /usr/local/bin/composer/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:264

ERRORS! Tests: 1, Assertions: 0, Errors: 1.


Same exact error.

Can anyone provide an example of phpunit >= 5.x opening a web browser using selenium >= 3.x? I can't find any example on the web that works for me. I'm running out of options.

wtangren commented 7 years ago

One more bit of information. If I change the derived class from PHPUnit_Extensions_Selenium2TestCase to PHPUnit_Extensions_SeleniumTestCase, and run this using phpunit 4.x and selenium standalone server 2.x, this runs just fine. It also works with phpunit 5.x, if you include:

require_once('/usr/local/bin/composer/vendor/autoload.php');

at the beginning of the file. It does not work with phpunit 6.x. (and yes, I'm using php 7.0).