title: How do I set a timezone in Selenium Chromedriver?
body: <p>I can't figure out how to set a timezone when using Chromedriver. Is there some ChromeOptions argument or something?</p>
  <p>The issue is that when I go to some sites (for example, <a href="https://whoer.net" rel="nofollow noreferrer">https://whoer.net</a>), it shows the system time that is equal to the time set on Windows. And I want to be able to change the Chromedriver's timezone somehow to perform timezone dependent testing.</p>
  <p>I tried to set some chrome options:</p>
  <pre><code>Map&lt;String, Object&gt; chromeOptions = new HashMap&lt;String, Object&gt;();
  chromeOptions.put(&quot;args&quot;, Arrays.asList(&quot;--disable-system-timezone-automatic-detection&quot;, &quot;--local-timezone&quot;));
  DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
  </code></pre>
  <p>It doesn't work.</p>
  <p>Tried to do some weird thing using Javascript:</p>
  <pre><code>((JavascriptExecutor) driver).executeScript(&quot;Date.prototype.getTime = function() { return 1 };&quot;);
     
  </code></pre>
  <p>It didn't help either.</p>
  <p><strong>EDIT:</strong></p>
  <p>Found this <a href="https://sqa.stackexchange.com/questions/8838/faking-system-time-date-with-selenium-webdriver">https://sqa.stackexchange.com/questions/8838/faking-system-time-date-with-selenium-webdriver</a></p>
  <p>Tried to execute javascript on page with the code copied from <a href="https://github.com/plaa/TimeShift-js" rel="nofollow noreferrer">TimeShift.js</a> like this:</p>
  <pre><code>((JavascriptExecutor) driver).executeScript(&quot;/*code from TimeShift.js here*/ TimeShift.setTimezoneOffset(-60);&quot;);
  </code></pre>
  <p>System time at <a href="https://whoer.net" rel="nofollow noreferrer">https://whoer.net</a> didn't change. What am I doing wrong?</p>