Locating Elements in Web Pages – Selenium Training
Locating Elements in Web Pages – Selenium Training
One website means a set of interlinked web pages. Every web page is having multiple elements like test boxes, images, drop down links , radio buttons, check boxes, links , tables, buttons , tool tips,,, etc.
To automate these elements System-Wide Defects (SWD) can support 8 types of locators.
- By.name ( “value” )
- By.id (“value”)
- By.className (“value”)
- By.cssSelector (“value”)
- By.xpath (“value”)
- By.linkText (“value”)
- By.tagName (“value”)
- By.partiallinkText (“value”)
In above 8 types of locator , value is mandatory. To get those values , we need an inspector . Firebug is add in to Firefox browser and it can work like inspector.
Navigation :
- Open FF browser
- Click menu icon ( right corner)
- Click add-ons
- Enter firebug in search box
- Click search
- Click install for firebug
- Restart Firefox browser after installation .
Firebug pointer icon is useful to get source code of specified element. From that source code, we are able to get values for name, id, class name ,tag name, X path.
Example :
- Launch mercury tours site
- Click register link
- Fill fields in registration page
- Click submit
- Close site
In this article we have seen Locating Elements in Web Pages – Selenium Training – Selenium Training . In the next article will see the Examples of Scripts for Automation.