- Selenium WebDriver 3 Practical Guide
- Unmesh Gundecha Satya Avasarala
- 241字
- 2021-08-13 16:08:05
WebElements
A web page is composed of many different types of HTML elements, such as links, textboxes, dropdown buttons, a body, labels, and forms. These are called WebElements in the context of WebDriver. Together, these elements on a web page will achieve the user functionality. For example, let's look at the HTML code of the login page of a website:
<html>
<body>
<form id="loginForm">
<label>Enter Username: </label>
<input type="text" name="Username"/>
<label>Enter Password: </label>
<input type="password" name="Password"/>
<input type="submit"/>
</form>
<a href="forgotPassword.html">Forgot Password ?</a>
</body>
</html>
In the preceding HTML code, there are different types of WebElements, such as <html>, <body>, <form>, <label>, <input>, and <a>, which together make a web page provide the Login feature for the user. Let's analyze the following WebElement:
<label>Enter Username: </label>
Here, <label> is the start tag of the WebElement label. Enter Username: is the text present on the label element. Finally, </label> is the end tag, which indicates the end of a WebElement.
Similarly, take another WebElement:
<input type="text" name="Username"/>
In the preceding code, type and name are the attributes of the WebElement input with the text and Username values, respectively.
UI-automation using Selenium is mostly about locating these WebElements on a web page and executing user actions on them. In the rest of the chapter, we will use various methods to locate WebElements and execute relevant user actions on them.
- Building E-commerce Sites with VirtueMart Cookbook
- 光網(wǎng)絡(luò)評(píng)估及案例分析
- 網(wǎng)絡(luò)故障現(xiàn)場(chǎng)處理實(shí)踐(第4版)
- 計(jì)算機(jī)網(wǎng)絡(luò)安全實(shí)訓(xùn)教程(第二版)
- Learning Karaf Cellar
- 農(nóng)產(chǎn)品物聯(lián)網(wǎng)研究與應(yīng)用
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- 數(shù)字通信同步技術(shù)的MATLAB與FPGA實(shí)現(xiàn):Altera/Verilog版(第2版)
- 物聯(lián)網(wǎng)通信技術(shù)
- 語(yǔ)音信號(hào)處理及Blackfin DSP實(shí)現(xiàn)
- 人人都該都懂的互聯(lián)網(wǎng)思維
- INSTANT LinkedIn Customization How-to
- 云工廠:開(kāi)啟中國(guó)制造云時(shí)代
- 智慧城市中的物聯(lián)網(wǎng)技術(shù)
- 新媒體交互藝術(shù)