To zoom in webpage on browser I searched solution and used two ways but on both I am receiving an error can someone please help me identify where is the mistake or whats wrong with the code. Browser I am using is Chrome
element = driver.findElement(By.tagName("html")); element.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));
Error received on this: Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot focus element
To solve above error I tried:
element = driver.findElement(By.tagname("html")); Actions actions = new Actions(driver); actions.moveToElement(element); actions.click(); actions.sendKeys(Keys.CONTROL, Keys.ADD); actions.build().perform();
Error received: unknown error: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
Also I tried to replace element "html" with "body" but zoom not worked