Selecting an option from the drop-down list that opens on the hover

advertisements

Need help in selecting an option from a drop that opens up on hover, here is the html i'm currently looking at or you can just look into the attached image -

<ul id="yui_3_7_0_4_1390312781452_393" class="dropdown-menu">

<li id="yui_3_7_0_4_1390312781452_392" class="action" value="4001">

    Promising

</li>
<li class="action" value="4003">

    In Discussion

</li>
<li class="action" value="4004">

    Phone screen

</li>
<li class="action" value="4005">

    Interview

</li>
<li class="action" value="4006">

    Offered

</li>
<li class="action" value="4007">

    Hired

</li>

And here is the code i'm trying -

  strings = driver.find_elements_by_class_name("action").text
  for text in strings:
      if text=='Offered':
          text.click()


Using a CSS Selector, you could click it by doing:

driver.find_element_by_css_selector("ul.dropdown-menu[id^='yui'] li[value='4006']").click()