123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Education >> View Article

Usage Of Locators In Selenium Webdriver

Profile Picture
By Author: Siyaram Ray
Total Articles: 79
Comment this article
Facebook ShareTwitter ShareGoogle+ ShareTwitter Share

Selenium WebDriver utilizes 8 locators to discover the components on website page. The accompanying is the rundown of question identifier or locators upheld by selenium.

We have organized the rundown of locators to be utilized while scripting:-

• id Select component with the predefined @id quality.
• Name Select first component with the predefined @name quality.
• Linktext Select connection (grapple tag) component which contains content coordinating the predetermined connection content
• Partial Linktext Select connection (grapple tag) component which contains content coordinating the predetermined incomplete connection content
• Tag Name Locate Element utilizing a Tag Name.
• Class name Locate Element utilizing a class Name .
• Css Select the component utilizing css selectors.
• Xpath Locate a component utilizing a XPath expression.

Finding an Element by ID:

The most productive way and favored approach to find a component on a page is By ID. ID will be the one of a kind on site page which can be effectively recognized.

IDs ...
... are the most secure and quickest locator choice and ought to dependably be the primary decision notwithstanding when there are different decisions; it resembles an Employee Number or Account which will be one of a kind.

Finding an Element by Name:

At the point when there is no Id to utilize, the following worth checking whether the coveted component has a name quality. Be that as it may, ensure there the name can't be one of a kind every one of the circumstances. On the off chance that there are numerous names, Selenium will dependably perform activity on the principal coordinating component.

Finding an Element by LinkText:

Finding a component with connect content is exceptionally basic. Be that as it may, ensure, there is just a single exceptional connection on the website page. On the off chance that there are numerous connections with similar connection content, (for example, rehashed header and footer menu joins), in such cases Selenium will perform activity on the main coordinating component with interface.

Finding an Element by Partial LinkText:

In an indistinguishable path from LinkText, PartialLinkText likewise works in a similar example.

Client can give incomplete connection content to find the component.

Finding an Element by TagName:

TagName can be utilized with Group components like, Select and registration/dropdowns.

Finding an Element by Class Name:

There might be numerous components with a similar name, on the off chance that we simply utilize findElementByClassName, ensure it is just a single. If not, you have to expand utilizing the classname and its sub components.

CSS Selector:

CSS basically used to give style tenets to the site pages and we can use for recognizing at least one components in the site page utilizing css.
On the off chance that you begin utilizing css selectors to distinguish components, you will love the speed when contrasted and XPath.

CSS selector is dependably the most ideal approach to find complex components in the page.

XPath Selector:

XPath is intended to permit the route of XML records, with the reason for choosing singular components, traits, or some other piece of a XML archive for particular preparing

There are two sorts of xpath:-

1. Local Xpath, it resembles coordinating the xpath to go in coordinate way.

Case:

html/head/body/table/tr/td

Here the benefit of determining local way is, finding a component is simple as we are specifying the immediate way. In any case, if there is any adjustment in the way (if something has been included/evacuated) at that point that xpath will break.

2. Relative Xpath.

In relative xpath we will give the relative way, it resembles we will advise the xpath to discover a component by telling the way in the middle.

Favorable position here is, if at all there is any adjustment in the html that works fine, until the point that unless that specific way has changed. Discovering location will be very troublesome as it have to check every single hub to find that way.

Illustration:

/table/tr/td

About Author:

Selenium training is provided at Infocampus. It is a selenium training institute in Bangalore. Learn selenium with core java with affordable training fees. Placement assistance is free at Infocampus. At the end of training, become a testing engineer. To attend free demo class, call 9738001024. For more details on Selenium Courses in Bangalore, visit http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html.

More About the Author

best institute for selenium training in Bangalore – Infocampus. Infocampus is an excellence training center for selenium courses in Bangalore. At Infocampus, selenium training is focused on practical and real time examples. Contact Infocampus at 8884166608 or visit http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html for complete details on selenium training.

Total Views: 499Word Count: 701See All articles From Author

Add Comment

Education Articles

1. Mastering The Digital Landscape Beyond The Walls: Your Guide To Osp Certification Training
Author: Passyourcert

2. Best Online Ai Ml Courses | Ai And Ml Training
Author: hari

3. B Tech Courses And B Tech Admission 2025 | Bennett University
Author: Rohit Ridge

4. Discover The Benefits Of Learning Mandarin In Middle Village
Author: Jony

5. Best Microsoft Fabric Online Training Course | Visualpath
Author: Visualpath

6. Best Site Reliability Engineering Training Alongside Sre Courses Online
Author: krishna

7. Large Language Model (llm) Courses | At Visualpath
Author: gollakalyan

8. Unlocking Bilingual Excellence: Your Guide To Chinese Language Education In Middle Village
Author: John

9. How Sleep Impacts Learning And Behaviour For Toddlers?
Author: elzee preschool and daycare

10. Sap Datasphere Course | Sap Datasphere Training
Author: naveen

11. Fashion Design Course In Pune: Crafting Your Path To A Stylish Future
Author: skilloradesignacademy

12. Graphic Design Course In Pune: Unleashing Creativity And Skill Development
Author: skilloradesignacademy

13. Boost Your Career With Digital Marketing Classes In Ahmedabad | Sdm
Author: Rohit Shelwante

14. Achieving Mastery: The Definitive Guide To Osp Certification Online Training And The Bicsi Outside Plant Designer Credential
Author: NYTCC

15. Best Microsoft Ax Training Courses For Career Growth
Author: Pravin

Login To Account
Login Email:
Password:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: