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

 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
主站蜘蛛池模板: 灵璧县| 五寨县| 山阴县| 土默特左旗| 慈溪市| 边坝县| 喀喇| 巴塘县| 龙胜| 大石桥市| 云浮市| 沙田区| 洪泽县| 民权县| 蓬安县| 克拉玛依市| 海门市| 遂昌县| 榆树市| 伊金霍洛旗| 丰城市| 藁城市| 顺昌县| 社旗县| 新化县| 宁远县| 喜德县| 新泰市| 浙江省| 泸水县| 资源县| 宝应县| 循化| 台东市| 邯郸县| 沐川县| 阿拉尔市| 大荔县| 吴川市| 大兴区| 四川省|