What is HTML?
As you know HTML Hyper Text Markup Language used for describing web pages. The basic structure of an HTML document includes tags, attributes and elements.
Each tag represents a document content. HTML contains tags with angle brackets like <html > and plain text. There are two tags one is start tag and second tag is end tag. Every tag should end with a forward slash before the tag name.
<tagname>content here</tagname> <tagname>is the opening tag and the</tagname>is the closing tag in an HTML document
Not all the tags have closing tags like <html > </html> closing and opening tags, some tags which do not have content around themselves like the line-break tag for example <br> - a line break which doesn’t hold any content.
<html> <head></head> <body> <h1>My First H1 Heading</h1> <p>My first paragraph content goes here</p> </body> </html>
HTML tags determine to display the content to display on the web browser. The current version (At the time of writing) of HTML is version 5. Tags can also have attributes, which provides additional information about an element. Attributes are always specified inside the opening tag and their values sit inside quotation marks.
They look something like <tag attribute="value">Hello</tag>.
Now coming to our selenium, we generally see the below elements / attributes in any of the simple web page.
- drop-down / list-box
- table, Etc....
We can divide the elements in three ways:
1. Single Elements
2. Group Elements
3. Customized Elements
For Single elements, we can easily find out an locator to work with selenium. We can locate by ID or by Link or by Link Text.
For Group elements, we should try to prefer name as identifier along with a combination of value or index property.
In the below screen shot, we can use name as "birthday_month" and value to select the particular month.