简体   繁体   中英

Not able to find element in selenium python

screenshot of error I m facing

searchbox=driver.find_element_by_xpath('//*[@id="search"]')
searchbox.send_Keys("abc")

above line is showing error it is saying 'list' object has no attribute 'send_Keys' . I have seen this kind of question on stack over flow but the solution is not helping me out

How did you get searchbox variable?

Did you use driver.find_element_by_xpath or driver.find_elements_by_xpath ?

I guess that you used find_elements_by_xpath . If you use find_elements_by_xpath , you can get a list of web elements.

In order to get a web element, you should use find_element_by_xpath .

searchbox = driver.find_element_by_id("search")

您可以用您选择的方法替换 find_element_by_...: https ://selenium-python.readthedocs.io/locating-elements.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM