1

在 Firefox 浏览器中,要求是等到元素(按钮)被点击。我们怎样才能实现它?

wait.Until(ExpectedConditions.ElementExists(By.Id(""))不在这里工作。

4

3 回答 3

2

您始终可以等待单击按钮后出现的元素的可见性..

new WebDriverWait(driver,60).until(ExpectedConditions.visibilityOfElementLocated(By.id("id_of_the_new_element")));
于 2013-10-12T03:55:38.100 回答
0

我不知道按钮触发了什么,但您可以尝试以下操作:

var buttonIsClicked = false;

while (!buttonIsClicked)
{
    // check something that can tell you if your button action was performed
    if (conditionsMet) buttonIsClicked = true;    
}
于 2013-10-11T14:58:56.850 回答
-2
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();
}
于 2017-03-10T07:52:26.333 回答