Skip to main content
Today I was faced by an odd behavior that is: when opening the page in chrome it was displayed in a larger resolution than the normal one which led to some tabs in the page being invisible.
I figured out a solution to this weird issue by doing a java script hack as follows:

  • Create a Javascript executer.
  • WebDriver driver = new ChromeDriver();
  • JavascriptExecutor jsExecuter; = (JavascriptExecutor) driver;  

  • Execute this java script command against your web driver 
  • js.executeScript("document.body.style.zoom='90%'");

  • //Do the required actions in the tabs

After all is done, don't forget to reset the browser to its default settings.
  • js.executeScript("document.body.style.zoom='100%'");

Comments