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 13, 2018 in Selenium by kappa3010
• 2,090 points
144 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 13, 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
• 27,930 points
1,050 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,550 points
2,848 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,510 points
3,478 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31 in Selenium by Sri
• 2,970 points
4,488 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,890 points
2,569 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 2 in Selenium by Sri
• 2,970 points
2,807 views
+9 votes
15 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
118,456 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
349 views