【发布时间】:2018-06-04 06:14:56
【问题描述】:
if href.startswith("https://store.steampowered"):
browser.get(href)
if browser.current_url.startswith("https://store.steampowered.com/agecheck"):
area = browser.find_element_by_id("agecheck_form")
location_field = area.find_element_by_id("ageYear")
for option in location_field.find_elements_by_tag_name("option"):
if int(option.text) == 1999:
option.click()
break
enter = browser.find_element_by_xpath('//*[@id="agecheck_form"]/a')
enter.location_once_scrolled_into_view.click()
我编写这段代码的目的是去 Steam 游戏页面获取游戏的价格。如果它遇到年龄检查墙,它会运行我上面的代码。
https://store.steampowered.com/agecheck/app/489830/
我的问题是无论我如何格式化输入按钮上的点击事件,它都会给我错误:'dict' object has no attribute 'click'
我已经搜索过什么是字典,但仍然很困惑。 我怀疑这个问题可能与我的选项循环有关。
【问题讨论】:
标签: python selenium selenium-webdriver