driver.php throwing an error
wtangren opened this issue · 6 comments
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?
I've also used the setBrowser command to use older versions of firefox (41 and 45). It didn't make any difference.
The URL doesn't make any difference. It doesn't get that far before it fails.
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:
- 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.
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).