Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opera is not working #343

Closed
ghost opened this issue Oct 14, 2016 · 3 comments
Closed

Opera is not working #343

ghost opened this issue Oct 14, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 14, 2016

Hers is the code

 public function testOperaBrowser()
    {
        $desired_capabilities = DesiredCapabilities::opera();
        $desired_capabilities->setCapability('acceptSslCerts', true);
        $driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $desired_capabilities);
        $driver->get('http://docs.seleniumhq.org/');
        $driver->wait(10);
        echo "The title is '" . $driver->getTitle() . "'\n";
        $driver->quit();

    }

Error Message 

/usr/bin/php "/Users/smunukuntla/Documents/Selenium PHP/vendor/phpunit/phpunit/phpunit" --no-configuration --filter "/::testOperaBrowser( .*)?$/" Selenium_Drivers_Implementation "/Users/smunukuntla/Documents/Selenium PHP/tests/1_Selenium_Drivers_Browsers/Selenium_Drivers_Implementation.php" --teamcity
Testing started at 4:53 PM ...
PHPUnit 5.5.7 by Sebastian Bergmann and contributors.


Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"opera","platform":"ANY","acceptSslCerts":true}}

Operation timed out after 30004 milliseconds with 0 bytes received
 /Users/smunukuntla/Documents/Selenium PHP/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:92
 /Users/smunukuntla/Documents/Selenium PHP/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:320
 /Users/smunukuntla/Documents/Selenium PHP/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:100
 /Users/smunukuntla/Documents/Selenium PHP/tests/1_Selenium_Drivers_Browsers/Selenium_Drivers_Implementation.php:51
@OndraM
Copy link
Collaborator

OndraM commented Oct 15, 2016

Hi @smunukuntla, what version of Opera do you use? If it is one of the latest blink-based Opera (version >12), you have to use operablink as name of the browser. The opera v12 and older are no longer supported by Selenium Server.

The support for the Opera-Blink is currently not builtin to php-webdriver helper functions, but you can easily do it manually:

$desired_capabilities = new DesiredCapabilities();
$desired_capabilities->setBrowserName('operablink');

Due to bug in OperaChromiumDriver you also have to define path to opera binary (operasoftware/operachromiumdriver#9), like this:

$desired_capabilities->setCapability('chromeOptions', ['binary' => '/usr/bin/opera']);

With this set-up and with Opera 40.0.2308.54 it does work for me. However, I created new issue (#344) to track the built-in support of Opera in php-webdriver.

@ghost
Copy link
Author

ghost commented Oct 15, 2016

@OndraM Thanks a ton for providing the solution. yes I'm using opera 40 version. As you suggested, it worked for me. Thanks again.

@salarmehr
Copy link

@OndraM Trying this in Windows I get:

 PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\UnknownServerException: The path to the driver executable must be set by the webdriver.opera.driver system property; for more information, see https://github.com/operasoftware/operachromiumdriver. The latest version can be downloaded from https://github.com/operasoftware/operachromiumdriver/releases in C:\www\www\webdriver\vendor\facebook\webdriver\lib\Exception\WebDriverException.php:114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants