import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
public class zoomINzoomOUT {
WebDriver driver;
@Test
public void BrowserZoomINandZoomOUT() throws Exception{
zoomIn();
Thread.sleep(3000);
zoomOut();
Thread.sleep(3000);
defaultset();
}
public void zoomIn() { //To zoom In page 5 times using CTRL and "+" keys.
for(int i=0; i<5; i++){
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, Keys.ADD);
}
}
public void zoomOut(){ //To zoom out page 9 times using CTRL and "-" keys.
for(int i=0; i<9; i++){
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, Keys.SUBTRACT);
}
}
public void defaultset(){ //To set browser to default level like CTRL+0
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, "0");
}
@BeforeTest
public void setup() {
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
}
WebDriver driver;
@Test
public void BrowserZoomINandZoomOUT() throws Exception{
zoomIn();
Thread.sleep(3000);
zoomOut();
Thread.sleep(3000);
defaultset();
}
public void zoomIn() { //To zoom In page 5 times using CTRL and "+" keys.
for(int i=0; i<5; i++){
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, Keys.ADD);
}
}
public void zoomOut(){ //To zoom out page 9 times using CTRL and "-" keys.
for(int i=0; i<9; i++){
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, Keys.SUBTRACT);
}
}
public void defaultset(){ //To set browser to default level like CTRL+0
driver.findElement(By.linkText("Selenium")).sendKeys(Keys.CONTROL, "0");
}
@BeforeTest
public void setup() {
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://seleniumsubbu.blogspot.in/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
}