Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我正在自动化一个包含多个复选框的网页。它点击了某个复选框并错过了某个复选框。这是我的代码。我应该在点击之前放置一个等待语句以避免这个问题。
IWebElement ClickElement = Wait.Until((d) => webDriver.FindElement(By.Id(parameter1))); ClickElement.Click();
您可以尝试在您的代码中进行此更改 -
在等待功能中,您正在使用检查元素是否存在findElement(By.Id(parameter1))
findElement(By.Id(parameter1))
isDisplayed()找到 WebElement 后,使用waitUntil 函数中的 with 方法检查是否显示。
isDisplayed()
您也可以使用方法检查它是否已经检查过isSelected()。
isSelected()