一、问题描述

  爬虫点击窗口或某一元素,出现'list' object has no attribute 'click' 错误

 

 

 二、解决方法

  修改find_方法,如图所示:

 

   说明: 1.只查找一个元素的时候,可以使用find_element_xxx(xxx)或find_elements_xxx(xxx);

       find_element-xxx(xxx)会返回一个WebElement节点对象;如果没找到会报错,而find_elements_xxx(xxx)没找到不会报错,会返回一个空列表

            2.查找多个元素的时候,只能用find_elements_xxx(xxx)[0](第一个对象),返回一个列表,列表里的元素全是WebElement节点对象。

 

posted on 2021-03-16 11:45  xiaoguan-bky  阅读(2523)  评论(0编辑  收藏  举报