title: Facebook WebDriver: Set User Agent (PHP)
body: <p>I'm trying to override the user agent string, but couldn't find the solution in the internet so far...</p>
  
  <p>This is my script:</p>
  
  <pre><code>&lt;?php
  namespace Facebook\WebDriver;
  
  use Facebook\WebDriver\Remote\DesiredCapabilities;
  use Facebook\WebDriver\Remote\RemoteWebDriver;
  
  require_once('vendor/autoload.php');
  
  $host         = 'http://localhost:4444/wd/hub';
  $capabilities = DesiredCapabilities::chrome();
  $capabilities-&gt;setPlatform(WebDriverPlatform::WINDOWS);
  $capabilities-&gt;setCapability('userAgent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36');
  $capabilities-&gt;setCapability('user-agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36');
  $driver       = RemoteWebDriver::create($host, $capabilities, 5000);
  
  $driver-&gt;get('http://localhost/browser-emu/testpage.php?bot=1234');
  
  // wait until the page is loaded
  $driver-&gt;wait()-&gt;until(
      WebDriverExpectedCondition::titleContains('register')
  );
  
  echo "User agent: " . $driver-&gt;findElement(WebDriverBy::cssSelector('#userAgent'))-&gt;getText();
  
  $driver-&gt;quit();
  </code></pre>
  
  <p>The page itself is as simple as:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;testpage...&lt;/h1&gt;
  
  &lt;?php
  printf("&lt;div id='userAgent'&gt;%s&lt;/div&gt; \n", $_SERVER['HTTP_USER_AGENT']);
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Doesn't matter what i've already tried, it's always saying the user agent is <code>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36</code>.</p>
  
  <p>Does anybody know how I can override that?</p>
  
  <p>I'm using (on Ubuntu):</p>
  
  <ul>
  <li>facebook/webdriver @ 1.4.1</li>
  <li>chromedriver @ 2.30.477691</li>
  </ul>