简体   繁体   English

亚马逊卖家中心 Selenium 下拉 select 错误使用 Python

[英]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.我尝试将 select function 用于其他下拉选项。 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.但是,当我在另一个形状和设计不同的下拉菜单上尝试此方法时,我不断收到一条消息,提示 python 找不到该元素。

The following is the code from Seller Central that I have been trying to figure out automating using Selenium: Code from Seller Central以下是来自卖方中心的代码,我一直在尝试使用 Selenium 进行自动化:来自卖方中心的代码

Thank you for your help!谢谢您的帮助!

IN the html you attached there is not attribute id with value 'downloadDateDropdown'在您附加的 html 中,没有值为“downloadDateDropdown”的属性 id

Also there are no select tag in the html, you can use select class with select tags. 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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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