Selenium Python 错误'dict'对象没有属性'click'


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()

我对这段代码的意图是去一个蒸汽游戏页面来获取游戏的价格。如果它遇到年龄检查墙,它会运行我上面的代码。

https://store.steampowered.com/agecheck/app/489830/

我的问题是无论我以何种方式格式化输入按钮上的单击事件,它都会给我错误:"dict"对象没有属性"click">

我已经搜索了什么是字典,但仍然感到困惑。 我怀疑这个问题可能与我的期权循环有关。

location_once_scrolled_into_view返回字典、webelementxy坐标。只需将其删除,硒将在点击前自动滚动到webelement

相关内容

最新更新