How to check if an element is visible with WebDriver

后端 未结 11 1538
臣服心动
臣服心动 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条回答
  •  萌比男神i
    2020-12-04 14:00

    Verifying ele is visible.

    public static boolean isElementVisible(final By by)
        throws InterruptedException {
            boolean value = false;
    
            if (driver.findElements(by).size() > 0) {
                value = true;
            }
            return value;
        }
    

提交回复
热议问题