find_element和find_elements

find_element,返回1个对象

find_elements,返回一个列表,里面包含多个对象

因此当你想对一个对象进行操作时,不能使用find_elements的表达方式,pychram会提示你:list没有click属性(AttributeError: 'list' object has no attribute 'click')

正确使用如下:

browser.find_element_by_xpath('//*[@id="headIDlistTable"]/th[1]/div/input').click()

猜你喜欢

转载自www.cnblogs.com/zjn-20161215/p/9025940.html