How to check if an element is visible with WebDriver

后端 未结 11 1577
臣服心动
臣服心动 2020-12-04 13:14

With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible.

WebDriver.findElement returns a WebElement<

11条回答
  •  囚心锁ツ
    2020-12-04 14:00

    try this

    public boolean isPrebuiltTestButtonVisible() {
        try {
    
            if (preBuiltTestButton.isEnabled()) {
    
                return true;
    
            } else {
    
                return false;
            }
    
        } catch (Exception e) {
    
            e.printStackTrace();
            return false;
        }
    }
    

提交回复
热议问题