我正在尝试从模式对话框中单击一个按钮,但是当该单击它时,我遇到了下一个错误:
OpenQA.Selenium.ElementClickInterceptedException : element click intercepted: Element <button onclick="Activar(193);" class="button mx-1" title="Recover">...</button> is not clickable at point (1206, 319). Other element would receive the click: <div class="ui-widget-overlay" style="width: 1349px; height: 613px; z-index: 1001;"></div>
我知道我需要使用等待助手,但我不知道如何使用它,这是我的等待助手代码:
public ConfigurationUsuario HabilitarConfiguracion()
{
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
iconoActivar.Click();
driver.SwitchTo().ActiveElement();
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//button[@title='Recover']"))).Click();
driver.FindElement(By.XPath("//button[@title='Recover']")).Click();
return new ConfigurationUsuario(driver);
}
可能是因为我不知道如何使用等待助手,但测试不要等待 20 秒,在模态对话框中 2-3 秒后,它会关闭,所以如果有人可以帮助我,我真的很感激