Skip to content

useragent not apply on Chrome with docker Selenium #573

@nono0481

Description

@nono0481

What are you trying to achieve? (Expected behavior)

I want to set a UserAgent and MobileEmulation when i start a browser on selenium.
For this, i'm using ChromeOption class.

In fact, Google Chrome Driver has changed the option name to manipulate browser arguments. Since version 2.31, the option name is not chromeOptions but goog:chromeOptions :

When I change the name in ChromeOptions class, it's works fine.
=> Can you update the code please ?

What do you get instead? (Actual behavior)

The user-agent is set on chromeOptions but when the browser is stated the user-agent is not applied

How could the issue be reproduced? (Steps to reproduce)

$desired_capabilities = DesiredCapabilities::chrome();
$options = new ChromeOptions();
$options->addArguments(array('--user-agent=Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X Tests_Autos; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'));
$desired_capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
$this->webDriver = RemoteWebDriver::create($selenium_server, $desired_capabilities);

Details

  • Php-webdriver version: 1.5
  • PHP version: 5.6
  • Selenium server version: 3.11
  • Operating system: Ubuntu 16.04
  • Browser used + version: Google Chrome 66.0.3359.181

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions