I am trying to change the Statement Type with selenium on this website, from Annual to Quarterly:
I've got the x-path of the "Quarterly" element here:
//*[@id="menu_A"]/ul/li[3]/a
...and this is my code:
quarterly_select = driver.find_element_by_xpath('//*[@id="menu_A"]')
quarterly_select.click()
quarterly_select = driver.find_element_by_xpath('//*[@id="menu_A"]/ul/li[2]/a')
quarterly_select.click()
Now, I know I can just select the third element of the list and be done, but some companies don't report semi-annually, and as such, the "Quarterly" element is the second in the dropdown sometimes, and the third other times.
So, I was thinking that I could just search for the dropdown element that has the text "Quarterly" in it instead, and so this is what I've come up with so far
//*[@id="menu_A"]/ul/li[text()="Quarterly"]/a
But this isn't working and throws the following error:
Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="menu_A"]/ul/li[text()="Quarterly"]/a"}
I'm not sure what to do. How can I locate the "Quarterly" element of this dropdown?

