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

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. 

主站蜘蛛池模板: 申扎县| 库尔勒市| 东平县| 青海省| 邵东县| 启东市| 彭阳县| 黄龙县| 额尔古纳市| 栾城县| 秀山| 林芝县| 大石桥市| 广昌县| 潼南县| 平顶山市| 九寨沟县| 沧源| 阿勒泰市| 鄂托克旗| 文昌市| 衡阳县| 汨罗市| 拜城县| 绥中县| 万荣县| 东阿县| 波密县| 广南县| 伊通| 建湖县| 潼南县| 佛教| 汉沽区| 万载县| 鄂伦春自治旗| 清水县| 扬州市| 台前县| 仙居县| 牡丹江市|