HTML Basics for Selenium
HTML Knowledge for Software Testers
Selenium is for Functional & Regression Testing, It supports Functional Testing of Web Applications only, HTML – Hypertext Markup Language is the standard markup language for creating web pages and web applications. The basic structure of an HTML document includes tags, attributes and elements.
Functional Testing Tools like UFT or Selenium conducts testing using front end objects, exception is there for Database testing, for Database Testing, no front-end object reference is required. But most of the operations in Functional testing are related to front-end object.
Selenium has to recognize web elements or html elements in web pages first then it performs Test operations, so we need to familiar with HTML fundamentals…
1) What is HTML?
HTML is a language for describing web-pages using ordinary text. HTML is not a complex programming language.
Every web page is actually a HTML file. Each HTML file is just a plain-text file, but with a .html file extension instead of .txt, and is made up of many HTML tags as well as the content for a web page. A web site will often contain many html files that link to each other.
HTML tags are the hidden keywords within a web page that define how your web browser must format and display the content.
HTML tags are element names surrounded by angle brackets. An HTML element usually consists of a start tag and end tag, with the content inserted in between.
HTML Attributes provide additional information about HTML elements.
> HTML, or HyperText Markup Language, is used to create the basic structure and content of a web page,
> CSS, or Cascading Style Sheets, is used for applying all visual styles.
2) HTML / Web Elements
i) Edit Box – to enter a value
ii) Link – redirects to another location or page
iii) Button – submits
iv) Image, Image Link, Image Button
v) Text box – To enter text
vi) Text Area – Text Area present in the Application
vii) Checkbox – Select or Unselect an Option
viii) Radio Button- Select any one option
ix) Drop down box – Select an Item
x) List box – Select One or more Items
xi) Combo box – Select an Item or Enter new Item
xii) Web table /HTML table – Displays content in tabeller format
xiii) Frame – Section of a web page
xiv) DatePickers – Pic data/month/year
3) Types of Web Elements / HTML Elements
We can divide the elements in three ways:
i) Single Elements
We can easily find out a locator for Single Element to work with selenium. We can locate by ID or by name or by linkText
ii) Group Elements
We should try to prefer name as identifier along with a combination of value or index property for Group elements,
iii) Customized Elements
Custom Elements allow web developers to define new types of HTML elements