- 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.
- 網(wǎng)絡(luò)教育學(xué)習(xí)指導(dǎo)
- 異構(gòu)基因共表達網(wǎng)絡(luò)的分析方法
- Learning Karaf Cellar
- 信息通信網(wǎng)絡(luò)建設(shè)安全管理概要2
- 面向物聯(lián)網(wǎng)的嵌入式系統(tǒng)開發(fā):基于CC2530和STM32微處理器
- 數(shù)字通信同步技術(shù)的MATLAB與FPGA實現(xiàn):Altera/Verilog版(第2版)
- 城域網(wǎng)與廣域網(wǎng)(第2版)
- Kong網(wǎng)關(guān):入門、實戰(zhàn)與進階
- VMware NSX網(wǎng)絡(luò)虛擬化入門
- 物聯(lián)網(wǎng)與智能家居
- 夢工廠之材質(zhì)N次方:Maya材質(zhì)手冊
- jQuery Mobile Web Development Essentials
- Learning Windows 8 Game Development
- 人人都該都懂的互聯(lián)網(wǎng)思維
- 物聯(lián)網(wǎng)工程導(dǎo)論(第3版)