I am trying to create a cross browser Python-Seleniumscript tag . Therefore, I need all the results to be the same, whatever webdriver( Chromeor IE). I can set the browser window size as follows:
driver.set_window_size(1920, 1080)
But the following code will return different values for Chromeand IE:
element = driver.find_element_by_xpath('some_xpath')
element.location
since the viewing area (where the web content is displayed) differ ( Chrome- 1910x998, IE- 1904x965), despite the same window size. To get these values, I used
driver.execute_script('return document.documentElement.clientHeight')
driver.execute_script('return document.documentElement.clientWidth')
so i tried
driver.execute_script('document.documentElement.clientHeight = "990px";')
driver.execute_script('document.documentElement.clientWeight = "1900px";')
but no luck
So the question is, how do I set the browser viewport size to selenium?