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

Interacting with WebElements

In the previous section, we saw how to locate WebElements on a web page by using different locator methods. Here, we will see all the different user actions that can be performed on a WebElement. Different WebElements will have different actions that can be taken on them. For example, in a textbox element, we can type in some text or clear the text that is already typed in it. Similarly, for a button, we can click on it, get the dimensions of it, and so on, but we cannot type into a button, and for a link, we cannot type into it. So, though all the actions are listed in one WebElement interface, it is the test script developer's responsibility to use the actions that are supported by the target element. In case we try to execute the wrong action on a WebElement, we don't see any exception or error thrown and we don't see any action get executed; WebDriver ignores such actions silently.

Now, let's get into each of the actions individually by looking at their Javadocs and a code example. 

主站蜘蛛池模板: 湖南省| 海伦市| 濮阳县| 石城县| 宣城市| 黄骅市| 保靖县| 肇源县| 永仁县| 漠河县| 潼南县| 繁峙县| 安丘市| 儋州市| 石家庄市| 边坝县| 隆子县| 股票| 喜德县| 阿合奇县| 黄浦区| 闽侯县| 怀远县| 郴州市| 望城县| 普定县| 衡东县| 宣汉县| 绥芬河市| 宁河县| 阿拉尔市| 府谷县| 台湾省| 西峡县| 桦甸市| 桃园市| 通山县| 阜阳市| 萨迦县| 海城市| 德令哈市|