How to select an Object by its class in Selenium

0 votes

There is a web page with a form embedded which has a field that uses jquery autocomplete function:

imageThe HTML which is rendered after a user name returns 1 or more results looks like below. But, I'm not able to figure out the way to "click".

imageWill jQuery type selector work is this case:

$(".ul.ui-autocomplete li:first a")
Apr 14, 2018 in Selenium by kappa3010
• 2,090 points
1,032 views

1 answer to this question.

0 votes

When it comes to Selenium, XPath will definately locate the element. The below code should work. Plz verify though.

xpath=//li[contains(@class, 'ui-autocomplete')]/li[1]/a
answered Apr 14, 2018 by king_kenny
• 3,710 points

Related Questions In Selenium

0 votes
1 answer

How to locate an element by partially comparing its attributes in XPath?

Hey Lakshya, you can locate an element ...READ MORE

answered Jun 24, 2019 in Selenium by Abha
• 28,140 points
5,261 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to use Actions class in Selenium Webdriver?

In seleniun webdriver it is not mandatory ...READ MORE

answered Apr 4, 2018 in Selenium by Damon Salvatore
• 5,980 points
4,075 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
13,673 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
9,142 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
7,221 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,874 views
+10 votes
17 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,360 points
197,975 views
0 votes
1 answer

How to choose from a drop-down in Selenium 2?

You can probably use the 'Select' class ...READ MORE

answered Apr 24, 2018 in Selenium by king_kenny
• 3,710 points
1,153 views
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