小编Ama*_*han的帖子

当前上下文中不存在名称“ExpectedConditions”

我必须在元素在 UI 中可见后执行操作,为此我使用下面的代码,但 ExpectedConditions 类抛出错误,指出名称“ExpectedConditions”在当前上下文中不存在。请建议。

public void WaitForElementLoad(By by, int timeoutInSeconds)
{
    if (timeoutInSeconds > 0)
    {
        WebDriverWait wait = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(timeoutInSeconds));
        wait.Until(ExpectedConditions.ElementIsVisible(by));
    }
}
Run Code Online (Sandbox Code Playgroud)

错误 CS0234 命名空间“OpenQA.Selenium.Support.UI”中不存在类型或命名空间名称“ExpectedConditions”(是否缺少程序集引用?)

c# selenium automation ui-automation selenium-webdriver

2
推荐指数
1
解决办法
7902
查看次数