Sunday, 22 September 2013

Zoom in & Zoom out [Windows | MAC]

Zoom in
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));

Zoom out
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));

Zoom 100%
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, "0"));

Zoom Feature on MAC
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.COMMAND, Keys.ADD));
html.sendKeys(Keys.chord(Keys.COMMAND, Keys.SUBTRACT));
html.sendKeys(Keys.chord(Keys.COMMAND, Keys."0"));

2 comments: