How to set browser viewport size
<p>I'm trying to create a cross-browser <code>Python-Selenium</code> test script. So I need all results to be same no matter which <code>webdriver</code> (<code>Chrome</code> or <code>IE</code>) I use.
I can set browser window size as follow:</p>

<pre><code>driver.set_window_size(1920, 1080)
</code></pre>

<p>But following code will return different values for <code>Chrome</code> and <code>IE</code>:</p>

<pre><code>element = driver.find_element_by_xpath('some_xpath')
element.location
</code></pre>

<p>as viewport area (where web-content displayed) sizes are different (<code>Chrome</code>- 1910x998, <code>IE</code>- 1904x965) despite of same window size. To get these values I used</p>

<pre><code>driver.execute_script('return document.documentElement.clientHeight')
driver.execute_script('return document.documentElement.clientWidth')
</code></pre>

<p>so I tried </p>

<pre><code>driver.execute_script('document.documentElement.clientHeight = "990px";')
driver.execute_script('document.documentElement.clientWeight = "1900px";')
</code></pre>

<p>but with no luck</p>

<p>So the question is how to set browser viewport size in <code>selenium</code>?</p>