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,010 points
30 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,590 points

Related Questions In Selenium

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,490 points
2,251 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,050 points
252 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,130 points
621 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,130 points
246 views
+9 votes
13 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,280 points
47,038 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,590 points
49 views