Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Selenium - AttributeError : WebElement object has no attribute sendKeys

I'm trying to pass through "ENTER" to a text field, using Selenium (Python). The text box requires that each phone number be entered on a new line, so it will look something like:

#Add the phone number#
Webelement.sendKeys(Keys.ENTER)

I've imported the following library:

from selenium.webdriver.common.keys import Keys

The problem I'm getting is that it fails with:

AttributeError: 'WebElement' object has no attribute 'sendKeys'

Does anyone know how to resolve this? I've been searching for a solution, but haven't been able to find anything.

like image 834
ChrisG29 Avatar asked Jul 22 '16 07:07

ChrisG29


1 Answers

Try using WebElement::send_keys() instead of sendKeys as below :-

from selenium.webdriver.common.keys import Keys

Webelement.send_keys(Keys.ENTER)
like image 182
Saurabh Gaur Avatar answered Sep 18 '22 16:09

Saurabh Gaur