package learning;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class MoveMouse {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://www.spicejet.com");
Actions actions = new Actions(driver);
actions.moveToElement(driver.findElement(By.linkText("ADD-ONS"))).build().perform();
Thread.sleep(3000);
waitForVisa(driver,driver.findElement(By.linkText("Dubai Visa Services")),20);
driver.close();
}
//Implicit wait method
public static void waitForVisa(WebDriver driver, WebElement element,int timeout){
new WebDriverWait(driver,timeout).until(ExpectedConditions.elementToBeClickable(element));
element.click();
}
}
Friday, March 8, 2019
Implicit wait in Selenium
Labels:
automation,
implicit-wait,
selenium,
testing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment