How to select a country from https://www.aliexpress.com/ ship to drowdown menu using Selenium and Python

后端 未结 3 1510
陌清茗
陌清茗 2020-12-12 03:52

On the website https://www.aliexpress.com, I need to change the country from the dropdown menu using selenium


         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-12 04:19

    you can use ActionChains. Element is your xpath

    from selenium.webdriver import ActionChains
    actions = ActionChains(browser)
    actions.move_to_element(element).perform()
    actions.click().perform()
    

    You can read more about ActionChains here https://www.selenium.dev/selenium/docs/api/py/webdriver/selenium.webdriver.common.action_chains.html

    or you can use click() function example:

    country_button = browser.find_element_by_class_name('ship-to')
    country_button.click()
    

提交回复
热议问题