【发布时间】:2019-05-28 02:27:30
【问题描述】:
我正在尝试点击以下链接中标有“取货”的按钮:
我的代码在下面,但在失败并出现错误之前什么都不做
元素不可交互
pickupurl = 'https://firehouse.alohaorderonline.com/StartOrder.aspx?SelectMenuType=Retail&SelectMenu=1000560&SelectSite=1291'
driver = webdriver.Chrome('d:\\chromedriver\\chromedriver.exe')
driver.implicitly_wait(80)
driver.get(pickupurl)
button = driver.find_elements_by_xpath('//*[@id="ctl00_ctl00_PickupButton"]')
button.click()
当我打印“按钮”时,代码似乎定位了一个元素,我得到了一个元素对象。
我尝试使用 driver.execute_script 来执行 onclick= 属性,但这也没有任何作用。
感谢任何帮助。
【问题讨论】:
-
你问你是否有错误的元素......你确实想要JS的
onClick会做......但我认为的主要问题是,你正在使用find_elements_by_xpath您应该使用不带“S”的find_element_by_xpath...
标签: python selenium web-scraping