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

 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
主站蜘蛛池模板: 榕江县| 宽城| 麻阳| 洛川县| 临桂县| 嫩江县| 通海县| 科技| 克什克腾旗| 高雄市| 乌拉特中旗| 文水县| 随州市| 陇西县| 扎兰屯市| 盱眙县| 新巴尔虎左旗| 清流县| 都昌县| 新巴尔虎左旗| 方正县| 连云港市| 建昌县| 东山县| 手机| 凤翔县| 定日县| 无锡市| 开远市| 芜湖市| 南皮县| 延吉市| 天祝| 弥勒县| 科尔| 吉安市| 彩票| 寻乌县| 昭平县| 连平县| 乌恰县|