How to click on the list of the <li> elements in an <ul> elements with selenium in python?
<p><a href="https://i.stack.imgur.com/0rFR0.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/0rFR0.jpg" alt="enter image description here"></a></p>

<p>I tried to select 2002 in dropdown menu.
It doesn't work at any late.
I used xpath</p>

<pre><code>driver.find_element_by_xpath("html/body/main/div/form/div[3]/div[1]/section/div[3]/fieldset/div[7]/dl[1]/dd/ul/li[1]/a").click()
</code></pre>

<p>but it doesn't work..I tried all the solutions I got...
How can I select this?</p>

<p>If you're able to open dropdown item but unable to click on item, you should try using <a href="http://selenium-python.readthedocs.io/waits.html#explicit-waits" rel="nofollow"><code>Explicit Waits</code></a> with <code>WebDriverWait</code> to wait until this element is visible and enable to click as below :-</p>

<pre><code>from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "ul#ulBirthYear a[data-value='2002']")))
element.click()
</code></pre>

<p>Or</p>

<pre><code>element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, "2002")))
element.click()
</code></pre>

python selenium