ul class="appt-dropdown-menu">
<li id="service-slot-blocker" class="slot-blocker-holder">
<li id="service-05b41399015375913">
<code class="light-blue"></code>
<span class="appt-details-dropdown-service-title">Facial</span>
<span class="appt-details-dropdown-service-time">59mins</span>
<div class="clearfix"></div>
<li id="service-sebd91399015377146">

I want to select dropdown value-Facial. I tried the below options for finding the element:

    WebElement s=driver.findElement(By.xpath("/html/body/div[2]/div[2]/div[1]/div[4]/div[3]/ul/li[2]/div[1]/ul/li[2]"));

I am getting error as -element not visible

  • 1
    Could you try the following and see if it works for you?driver.findElement(By.xpath("//span[contains(.,'Facial')]")).click() If not then more information is needed. Currently the html given isn't a "dropdown" so if it appears as a dropdown then the code is doing something to render it as such. In general html5 has this as a select element which can be parsed with it's own SelectElement class.
    – mutt
    Commented Aug 11, 2014 at 17:33
  • possible duplicate of How do I work with dropdowns in Selenium Webdriver? Commented May 6, 2015 at 17:53

7 Answers 7


I am getting error as -element not visible: is the element visible? Selenium can't interact with invisible elements.

If it is visible, you can do something like:

  • Not exactly. The default selenium element handlers require it to be visible however the Actions class will execute on anything the hardware is able to interact with so long as the DOM can be read. If it is on the screen but invisible and the mouse can click in a location that the element exists then it will work. My guess though is that the control is not a standard control and you would have to move the mouse to a different element in order for the dropdown controls to appear and be actionable for the mouse.
    – mutt
    Commented Aug 11, 2014 at 19:28

To select a value from a dropdownlist or multiselect using Selenium, you will have to use the Select function instead of trying to click on the element.


Select dropdown = new Select(driver.findElement(By.className("appt-dropdown-menu")));

but as Mutt pointed out, the html code you have given does not contain a dropdown element. for the above code to work you have to located a valid dropdown.


I believe this application utilizes a GUI rendering library like YUI, PrimeFaces etc.

While manually testing, which element do you click on to make the dropdown options visible?

Kindly paste the HTML code for the element which you clicked and for the menu itself.

For eg.

// Dropdown Trigger
<div id="xyz" class="appt-dropdown-button">...</div>
// Dropdown Menu 
<ul class ="appt-dropdown-menu"> .. </ul>

Kindly provide the above details and I will be able to provide you with the code to select the correct option. Thanks.


In this case, I think you should capture the element first, just use capture by cssSelector.


OR, if the element is not captured by using CSS above, I think this element is temporary hidden then we should use ActionClass to action on the parent element first, --> click the sub-child element after.

On your given html, it's not the "Select" actually, so I don't think we can use SelectElement class. If it's , we can use: The HTML will be:

<select id="optionID">
<option value="Value">Option</option>
<option value="NotValue">Not Option</option>

So, the select class will be following:

WebElement selectElement = driver.findElement(By.id("optionID")); 
Select select= new Select(selectElement);

Hope this help.


Using Python :

element = wd.find_element_by_xpath(

"//ul[@class='appt-dropdown-menu']/li[2]/span[@class='appt-details-dropdown-service-title' and contains(.,'Facial')]"



When you create a drop down using HTML ul and li tags, then to access the drop down list, First you have click on Drop down box then try finding "Facial" element.


Seems like dynamic drop down. You have to provide more information about the HTML code in order to get it done easily. You can follow the process:

  1. Make sure to click on to drop down whether it is unordered list <ul> or <li>
  2. Then only you can select the option by directly clicking on to that element.

Note: Default api provided by selenium may not work in dynamic dropdowns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.