Selenium报错 AttributeError: ‘dict‘ object has no attribute ‘xx‘ (已解决)

selenium的查找元素并点击:self.driver.find_element_by_id("xx").click()

执行这句时报错:AttributeError: 'dict' object has no attribute 'click',断言发现,find_element_by_id确实返回了一个dict类型。

网上寻找答案后,解决如下:

将安装的selenium 4.0版本,降为3.141.0版本即可。

参考:https://stackoverflow.com/questions/69582816/python-selenium-attributeerror-dict-object-has-no-attribute-get-attribute

Guess you like

Origin blog.csdn.net/weixin_42152949/article/details/122237637