Reputation: 171
i am using selenium webdriver for chrome. I am testing an web application with lot of ajax contents so after login into the application it will take some seconds to load ajax content in home page.
I've used explicit wait after login to wait until finding the element. But it fails mostly. I've given 25 seconds to wait but it fails after 4 seconds of wait . The error is ,...
Unknown error: Element <a href="/ls/create_new" class="ajax addDashButton hasLink">...</a> is not clickable at point (144, 223).
Other element would receive the click: (Session info: chrome=60.0.3112.78) (
My code is ..
public class login {
WebDriver driver;
@Test
public void f() {
System.setProperty("webdriver.chrome.driver", "filepath/chromedriver");
driver = new ChromeDriver();
driver.get("URL");
driver.manage().window().maximize();
driver.findElement(By.name("username")).sendKeys("username");
driver.findElement(By.name("password")).sendKeys("password");
driver.findElement(By.className("login")).click();
WebDriverWait wait = new WebDriverWait(driver, 25);
wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText("Create New App")));
driver.findElement(By.linkText("Create New App")).click();
}
}
This is just part of my code ..What is the correct way to use webdriver wait. TY
Upvotes: 0
Views: 760
Reputation: 99
Intead of using presenceOfElementLocated, try once visibilityOfElementLocated .
for more information use can check the below link- What is the exact difference between "ExpectedConditions.visibilityOfElementLocated" and "ExpectedConditions.presenceOfElementLocated"
Upvotes: 2