Today, practice front-end positioning element to the input box, enter a user name and password, reported a mistake: AttributeError: 'list' object has no attribute 'send_keys'
This is the error code:
1 username = driver.find_elements_by_xpath('//input[@placeholder="用户名/邮箱"]') 2 username.send_keys("xxxx") 3 password = driver.find_elements_by_xpath('//input[@placeholder="密码"]') 4 password.send_keys("xxxx")
Solution : The find_element S _by_xpath changed find_element_by_xpath
The reason : find_element S is to find more qualified elements, returns a list, the list is not "send_keys" this property, so the error;
find_element is to find the first matching element, returns an object.