giorgiosironi / phpunit-selenium

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

ChromeDriver args DesiredCapabilities #367

Closed paulbriton closed 8 years ago

paulbriton commented 8 years ago

I'm facing the chrome driver bug which shows the developper mode extensions pop-up and I'm trying to disable chrome extensions as a workaround. As said in the documentation there is a args property but it seems that this property is ignored. I'm using SeleniumWebDriver 2.48.1 and PHPUnit 4.8. Here is what I've tried :

public static $browsers = array(
  array(
  'name'        => 'Windows Chrome',
  'browserName' => 'chrome',
  'host'        => 'localhost',
  'port'        => 4444,
  'timeout'     => 30000,
  'desiredCapabilities' => array(
    'unexpectedAlertBehaviour' => 'accept',
    'platform' => 'WINDOWS',
    'args' => array('disable-extensions'),
  )
);

I've also tried without the array(), with --disable-extensions, with -disable-extension ...

Am I doing something wrong ? If not do you plan to support this capability ? Or do you have another workaround to avoid the pop-up ?

giorgiosironi commented 8 years ago

desiredCapabilities are passed transparently to the Selenium server, here is an example of their specification: https://github.com/giorgiosironi/phpunit-selenium/blob/master/Tests/Selenium2TestCase/MobileFeaturesTest.php Try creating a session with a curl command first on your server to see how it responds, does not seem to be a PHP-side issue.

paulbriton commented 8 years ago

My bad, it's not an issue at all.. I was looking for the right syntax to specify chrome options. For those who are also looking for a way to specify them here is a way :

public static $browsers = array(
  'name'        => 'Windows Chrome',
  'browserName' => 'chrome',
  'host'        => 'localhost',
  'port'        => 4444,
  'timeout'     => 30000,
  'desiredCapabilities' => array(
    'unexpectedAlertBehaviour' => 'accept',
    'platform' => 'WINDOWS',
    'chromeOptions' => array('args' => array("disable-extensions"))
  )
);

By the way, thank's for the curl idea

techhemant commented 5 years ago

I'm getting error PHP Fatal error: Uncaught TypeError: Argument 2 passed to PHPUnit_Extensions_SeleniumBrowserSuite::fromClassAndBrowser() must be of the type array, string given,