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,080 points
82 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,690 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,720 points
123 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,510 points
2,573 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
1,494 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,850 points
1,465 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,850 points
1,227 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,370 points
83,718 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,690 points
179 views