Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
selenium python错误';dict';对象没有属性';单击';_Python_Selenium_Selenium Webdriver - Fatal编程技术网

selenium python错误';dict';对象没有属性';单击';

selenium python错误';dict';对象没有属性';单击';,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我编写这段代码的目的是转到steam游戏页面,了解游戏的价格。如果遇到年龄检查墙,它将运行我上面的代码 我的问题是,无论我如何格式化enter按钮上的click事件,它都会给我错误:“dict”对象没有属性“click” 我已经查过哪些词典了,但仍然摸不着头脑。 我怀疑这个问题可能与我的选项循环有关。location\u一旦滚动到\u视图中就会返回字典、webelement的x和y坐标。只需删除它,selenium就会在单击之前自动滚动到webelement。location\u一旦滚动到视图

我编写这段代码的目的是转到steam游戏页面,了解游戏的价格。如果遇到年龄检查墙,它将运行我上面的代码

我的问题是,无论我如何格式化enter按钮上的click事件,它都会给我错误:“dict”对象没有属性“click”

我已经查过哪些词典了,但仍然摸不着头脑。
我怀疑这个问题可能与我的选项循环有关。

location\u一旦滚动到\u视图中
就会返回字典、
webelement
x
y
坐标。只需删除它,selenium就会在单击之前自动滚动到
webelement

location\u一旦滚动到视图中
就会返回字典、
webelement
x
y
坐标。只需删除它,selenium将在单击之前自动滚动到
webelement

非常感谢!我知道这会很简单/愚蠢谢谢!我知道这会是件简单/愚蠢的事
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()