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
36 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
1 answer
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
106 views
+1 vote
1 answer

How to handle a combobox which when clicked open in new window with list of items(to be clicked) in selenium java ?

@Pavithra, you can try using following commands ...READ MORE

answered Oct 29, 2019 in Selenium by Abha
• 27,800 points
244 views
0 votes
1 answer

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,510 points
2,213 views
0 votes
1 answer
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,870 points
1,821 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
1,815 views
+2 votes
2 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
• 57,530 points
111 views
0 votes
1 answer