public class ExplicitDemo {
public static void main(String[] args) throws InterruptedException {
WebDriver d = new FirefoxDriver();
d.manage().window().maximize();
d.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
//d.get("https://www.gmail.com");
d.navigate().to("https://www.gmail.com");
Thread.sleep(2000);
//enter text into username field
d.findElement(By.name("Email")).sendKeys("rameshatbtech@gmail.com");
Thread.sleep(2000);
//click on next button
//d.findElement(By.id("next")).click();
//explicit wait for search field
WebDriverWait wait = new WebDriverWait(d, 10);
// wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("next")));
wait.until(ExpectedConditions.elementToBeClickable(By.id("next")));
d.findElement(By.id("next")).sendKeys(Keys.ENTER);
Thread.sleep(3000);
}
}
public static void main(String[] args) throws InterruptedException {
WebDriver d = new FirefoxDriver();
d.manage().window().maximize();
d.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
//d.get("https://www.gmail.com");
d.navigate().to("https://www.gmail.com");
Thread.sleep(2000);
//enter text into username field
d.findElement(By.name("Email")).sendKeys("rameshatbtech@gmail.com");
Thread.sleep(2000);
//click on next button
//d.findElement(By.id("next")).click();
//explicit wait for search field
WebDriverWait wait = new WebDriverWait(d, 10);
// wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("next")));
wait.until(ExpectedConditions.elementToBeClickable(By.id("next")));
d.findElement(By.id("next")).sendKeys(Keys.ENTER);
Thread.sleep(3000);
}
}
No comments:
Post a Comment