Java Wrapper method for waiting for element to be available for Apache Cordova Webview driven App

别说谁变了你拦得住时间么 提交于 2019-12-02 06:39:37

As per the code block you have shared I don't see any value addition to check if element is present through implicitlyWait. The implementation looks as a pure overhead. Instead if you look into the Java Docs of ExpectedCondition Interface from the org.openqa.selenium.support.ui package which models a condition that might be expected to evaluate to something that is not null nor false also contains the ExpectedConditions Class that can be called in a loop by the WebDriverWait Class and the methods provides more granular approach to confirm if a particular condition have achieved or not. This gives us much more flexibility in choosing the desired behavior of a WebElement. Some of the widely used methods are :

  • Presence of an element :

    presenceOfElementLocated(By locator)
    
  • Visibility of an element :

    visibilityOfElementLocated(By locator)
    
  • Interactibility of an element :

    elementToBeClickable(By locator)
    

Note : As per the documentation Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!