Basic HTML concepts and knowledge mandatory for Selenium web driver API
What is HTML and its use?
All tech people know that HTML is a
hypertext markup language used for describing web pages. Each html tag
represents a document content. HTML tags contains tags with angle brackets (greater
then and less then sign) like and plain text.
There are two tags one is start tag
and second tag is end tag. Each tag should end with a forward slash before the
tag name.
Syntax for HTML:
<tagnameExample> Put the content here </tagnameExample>
<html>
<head></head>
<body>
<h1>For Heading purpose
</h1>
<p>My first paragraph content lies here
</p>
</body>
</html>
HTML tags build for display the
content to display on the web browser.
Now returning to selenium web driver API, we generally see the below elements and attributes in any of the simple and complex web page.
Now returning to selenium web driver API, we generally see the below elements and attributes in any of the simple and complex web page.
- Text-box
- Text-area
- link
- radio-buttons
- check-box
- drop-down and list-box
- Table, Etc....
You can divide the elements in three
different ways:
1. Single Element
2. Group Element
3. Customized Element
1.For Single element, we can
easily find out a locator to work with selenium web driver API. We can locate
by ID or by Link or by Link Text.
Example- Lets Check face book example like- Email and password text
box
Below is the html code
<input id"email"
class="inputtext" type ="text" value=""
name="email">
2.For Group elements, Should try to prefer name as
identifier along with a combination of value or index property.
Example- Let see
the Birthday selection drop down like Month-Day-Year
<option selected ="1" value
="0">Month</option>
<option value ="1">Jan</option>
<option value ="2">Feb</option>
<option value ="3">March</option>
And so on...
3.For Customized elements, this is a customize elements,
here we can use another type of locators like xpath, css selectors, we will discuss
this in future article in details.
Example- Let see the Birthday selection drop down like
Month-Day-Year
<div selected ="1" value
="0">Month</div>
<div value ="1">Jan</div>
<div value ="2">Feb</div>
<div value ="3">March</div>
and so on...
No comments:
Post a Comment