Question

In firefox browser, requirement is to wait until a element(button) is getting clicked. How can we achieve it?

wait.Until(ExpectedConditions.ElementExists(By.Id("")) is not working here.

Was it helpful?

Solution

you can always wait for visibility of element which appears after the button is clicked..

new WebDriverWait(driver,60).until(ExpectedConditions.visibilityOfElementLocated(By.id("id_of_the_new_element")));

OTHER TIPS

I don't know what the button triggers, but you can try something like:

var buttonIsClicked = false;

while (!buttonIsClicked)
{
    // check something that can tell you if your button action was performed
    if (conditionsMet) buttonIsClicked = true;    
}
By element= By.xpath("//body/div[3]/div[1]/div/a/span");
WebDriverWait wait=new WebDriverWait(driver, 60);
WebElement var = wait.until(ExpectedConditions.visibilityOfElementLocated(element));
if(var.isDisplayed())
{
    var.click();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top