webdriverio不支持elementToBeClickable

时间:2016-03-04 04:29:30

标签: javascript selenium-webdriver webdriver-io

似乎'waitForEnabled'与Webdriver的elementToBeClickable不同。有人可以帮助它的API吗?

2 个答案:

答案 0 :(得分:0)

public static WebElement ElementToBeClickable(WebElement element)
 {
    try
 {
             if (element != null && element.isDisplayed() && element.isEnabled())
             {
                 return element;
             }
             else
             {
                 return null;
             }
         }
catch (StaleElementReferenceException e)
         {
             return null;
         }
 }

尝试以上方法:

答案 1 :(得分:-1)

WebDriverWait wait = new WebDriverWait(driver,timeout);

element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator));