Which of the locators should be used when

0 votes
Which of the id, name, XPath or CSS selector should be used in different scenerios?
Jun 21, 2019 in Selenium by Kapil
397 views

1 answer to this question.

0 votes

Hi @Kapil, you should use ID or Name as locators if the page has unique names or identifiers available. If they are not available, then you can go for a CSS selector as it is faster than the XPath. When none of the preferred locators is present, then you can try the XPath, as it helps you in identifying even the complex elements.

answered Jun 24, 2019 by Kabir

Related Questions In Selenium

0 votes
2 answers

What are the wait methods which can be used to handle AJAX calls?

Hi , for Ajax call better to use Explicit ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
1,255 views
0 votes
1 answer

Which click command can be used to click on a specific part of webpage in Selenium?

Hi Apeksha, in Selenium IDE to click on ...READ MORE

answered Oct 17, 2019 in Selenium by Devesh
1,471 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,740 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,618 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,696 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,557 views
+2 votes
3 answers

What are the different Locators that can be used to access Web Elements?

@Nitesh, I would like to tell you ...READ MORE

answered Dec 12, 2018 in Selenium by Priyaj
• 58,090 points
1,143 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP