Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

Selenium locators and Firefox addons

Author: Info Campus
by Info Campus
Posted: Nov 24, 2017

In this article, lets learn about selenium locators are to find components on the program and also Firefox addons to recognize web components for Selenium.

Selenium gives distinctive kind of locators to exceptionally distinguish web components on the program (HTML content).To see the HTML substance and keep an eye on a webelement:

For Mozilla:

Introduce firebug and firepath addon (mozilla program)

For Chrome:

Right tap on the webelement and afterward tap on "Investigate component" to get the coveted html content for that component.

For IE:

Utilize work key 'F12' to get the html content.Let's discussion about the firebug in mozilla program for the present to find out about locators, Essential: mozilla addons are introduced.

Diverse sort of locators in selenium:

by id:

See underneath screenshot for the means to get the id of a webelement, for this situation we need to get the id of email field on facebook.com

by name:

Search for the html content with catchphrase -> name =

Exceptional case for by name: If different components have a similar incentive for a name property, in the beneath screenshot, 2 radiobuttons have same name as tripType.At that point utilize channels to additionally refine area technique. The default channel sort is esteem (coordinating the esteem characteristic), so for our situation:

name = tripType esteem = oneway

name = tripType esteem = twoway

thusly, we recognize both the radiobuttons

by linktext:

This is a basic technique for finding a hyperlink in your website page by utilizing the content of the connection (i.e the name given to the 'a' tag in the html content). In the event that two connections with a similar content are available, at that point the first match will be utilized.

by CSS Selector:

CSS (Cascading Style Sheets) is a dialect for portraying the rendering of HTML also, XML records. CSS utilizes Selectors for restricting style properties to components in the record. we should perceive how we can get the css selectors from the html content:

css=tag#id

css=tag.class

css=tag[attribute=value]

css=tag.class[attribute=value]

css=tag:contains("inner content")

Note: internal content is the correct word that is shown on program for that component.

by xpath:

XPath is the dialect utilized for finding hubs in a XML archive and HTML can be a usage of XML (XHTML). Selenium opens up a wide range of new potential outcomes, for example, finding the third checkbox on the page. XPath locators can likewise be used to determine components by means of properties other than id and name.

Firefox addons to recognize web components for Selenium:-

To see the HTML substance and keep an eye on a web element, there are distinctive routes for various programs, for the most part individuals utilize firefox program to distinguish the web components as it has more number of addons for web component recognizable proof.

1. Firebug –

When firebug is introduced, you will see a bug symbol on the correct best corner of the program, click according to the underneath screen request to distinguish the webelements.

2. firepath –

will get this with the firebug addon: which shows the relative or outright xpath of a web component

3. xpath checker –

Another addon to mozilla to distinguish the xpath as demonstrated as follows, Without flaw tap on any program component and tap on the xpath… alternative.

4. WebDriver Element Locator –

Right tap on any web component and tap on the java locatiors… choice to get the xpath. For Chrome program addon, allude Chrome addon for selenium.

About Author:

Become a selenium testing engineer in 2 months by joining Infocampus. Infocampus is an institute that provides selenium training in Bangalore. Along with training, infocampus also helps candidates to get the job in testing field by providing 100% assistance on placement. Free demo classes, mock interviews, live projects, real time examples with practical oriented classes are available only at Infocampus. It is one of the best selenium training institutes in Bangalore. Contact 9738001024 or visit http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html for details on selenium training.

About the Author

Infocampus is a training institute that offers training on different technologies. Call 9738001024 for more details. Enquire at http://infocampus.co.in

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: Info Campus

Info Campus

Member since: Dec 10, 2016
Published articles: 413

Related Articles