July 2019
Intermediate to advanced
536 pages
12h 57m
English
On a web page, each element is uniquely identified by an ID attribute, which is optionally provided. An ID can be assigned manually by the developer of the web application or left to be dynamically generated by the application. Dynamically-generated IDs can be changed on every page refresh or over a period of time. Now, consider the HTML code of the Search box:
<input id="search" type="search" name="q" value="" class="input-text required-entry" maxlength="128" placeholder="Search entire store here..." autocomplete="off">
In the preceding code, the id attribute value of the search box is search.
Let's see how to use the ID attribute as a locating mechanism to find the Search box:
@Testpublic void byIdLocatorExample() {
Read now
Unlock full access