简体   繁体   中英

Amazon Seller Central Selenium dropdown select error using Python

I have been trying to automate Amazon Seller Central's storage report download. I have tried to use the select function for other dropdown options. Here is what I coded for other dropdown menus and worked:

select = Select(driver.find_element_by_id('downloadDateDropdown'))

select.select_by_value('0')

However, when I tried this method on another dropdown which has a different shape and design, I keep getting a message that python cannot find the element.

The following is the code from Seller Central that I have been trying to figure out automating using Selenium: Code from Seller Central

Thank you for your help!

IN the html you attached there is not attribute id with value 'downloadDateDropdown'

Also there are no select tag in the html, you can use select class with select tags. FOr other tags use normal click

  1. CLick Dropdown menu to view the list
  2. Click the displayed option

Code would be:

WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.XPATH, "//xpathofdropdownmenu"))
).click()

WebDriverWait(driver, 10).until(
    EC.visibility_of_element_located(
        (By.XPATH, "//xpathofoption"))
).click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM