官术网_书友最值得收藏!

 The isDisplayed() method

The isDisplayed action verifies whether an element is displayed on the web page and can be executed on all the WebElements. The API syntax for the isDisplayed() method is as follows:

boolean isDisplayed()

The preceding method returns a Boolean value specifying whether the target element is displayed on the web page. The following is the code to verify whether the Search box is displayed, which obviously should return true in this case:

@Test
public void elementStateExample() {
WebElement searchBox = driver.findElement(By.name("q"));
System.out.println("Search box is displayed: "
+ searchBox.isDisplayed());
}

The preceding code uses the isDisplayed() method to determine whether the element is displayed on a web page. The preceding code returns true for the Search box:  

Search box is displayed: true
主站蜘蛛池模板: 府谷县| 武城县| 长沙县| 家居| 靖远县| 孟村| 砚山县| 江北区| 宁乡县| 平陆县| 孝昌县| 荥阳市| 北京市| 衡阳市| 天水市| 响水县| 祥云县| 阳城县| 渑池县| 朝阳区| 永定县| 腾冲县| 大城县| 兴国县| 永州市| 沁阳市| 石门县| 册亨县| 会宁县| 屏东市| 综艺| 隆林| 子长县| 孝义市| 余姚市| 宣城市| 昆山市| 慈溪市| 莎车县| 深圳市| 米脂县|