-1

enter image description here

I have tried this to navigate from the season's drop down.

try:
    add = driver.find_element_by_xpath(//ul[@class='dropdown dropdown__filter']/li[@class='pv-h'])
except:
    print("Error on dropdown")

try:
    Hover = ActionChains(driver).move_to_element(add).perform()
    data=driver.find_element_by_by_xpath(/ul[@class='dropdown dropdown__filter']/li[@class='pv-h'])
    time.sleep(2)

Error 1: add = driver.find_element_by_xpath('//ul[@class='dropdown dropdown__filter']/li[@class='pv-h']')

Error 2: Deprecation error: try find_elements_by()

karthi
  • 23
  • 1
  • 4
  • Please go through the below link https://stackoverflow.com/questions/7867537/how-to-select-a-drop-down-menu-value-with-selenium-using-python – Ashok Kakade Dec 08 '21 at 05:48

1 Answers1

0

It won't work because selenium does not allow to find elements by compound classes, ie. class attribute that has more than one value.

Try this:

try:
    add = driver.find_element_by_xpath(//ul[contains(@class='dropdown__filter')]/li[@class='pv-h'])
except:
    print("Error on dropdown")
Alichino
  • 1,668
  • 2
  • 16
  • 25