The AttributeError: ‘WebElement’ object has no attribute ‘sendKeys’ in Python appears when you call Java-style sendKeys instead of send_keys().
Understanding The AttributeError Message
This Selenium Python error looks scary at first, but it simply tells you that the WebElement object you are working with does not expose any attribute named sendKeys. Put simply, Python has never heard of that exact method on this type of object.
Under the hood, Selenium ships one method for sending text and keystrokes from Python code into a web field. That method is called send_keys() with an underscore and lowercase letters. When Python sees a call to sendKeys(), it tries to find an attribute with that exact name on the WebElement, fails, and raises the AttributeError.
Testers often trip over this message when they follow a Java tutorial while writing Python code. Java bindings for Selenium use sendKeys() with camel case. Python bindings for Selenium use send_keys(). The difference looks tiny in an editor, yet it changes the method name completely for the Python runtime.
You might also bump into this message when you copy and paste code between projects without checking the language. A quick scan of your method calls, especially anything related to keyboard input, usually reveals the mismatch quickly. When you see AttributeError: ‘WebElement’ Object Has No Attribute ‘SendKeys’ during a run, read it as Python complaining about a missing method name instead of a browser failure.
Common Causes Of AttributeError: ‘WebElement’ Object Has No Attribute ‘SendKeys’
While the wrong method name causes most cases of this AttributeError, a few other patterns can land you in the same spot. Running through each cause one by one helps you fix the current test and avoid repeating the same slip in new scripts.
- Java naming in Python code — The test uses
element.sendKeys(...)instead ofelement.send_keys(...), which works in Java but not in Python. - Typo in the method call — Small spelling changes such as
sendkeysorsend_Keyslead to the same AttributeError because Python treats each spelling as a new attribute. - Custom wrapper shadowing WebElement — A helper function wraps Selenium elements and returns a different object that does not implement
send_keys()at all. - Stale or wrong element type — The locator points to a node that cannot accept text input, such as a
that only holds layout, so the project uses the wrong interface for the task.
These patterns still connect back to the same core idea: the object in memory does not have the attribute you are calling. The exact wording of AttributeError: 'WebElement' object has no attribute 'SendKeys' gives you both the runtime type and the missing attribute, which points you toward a focused fix.
Once you step through the common triggers for this webdriver issue, the AttributeError feels less like a random failure and more like a clear signal. Each failed run tells you to double check the method name, the object type returned by your locator, and the test helper layers between your code and Selenium itself.
Fixing The ‘WebElement’ Object Has No Attribute sendKeys Issue
The direct fix for the AttributeError comes down to two steps: calling the correct method name and pointing that call at a genuine input element. Changing just a few characters in your method call often resolves the problem on the next run.
Use The Correct send_keys Method
In Selenium Python, each WebElement that accepts keyboard input exposes send_keys(). That method takes a string, one or more keycode constants, or a mix of both. Here is a clean pattern that replaces a failing AttributeError line:
from selenium.webdriver.common.keys import Keys
field = driver.find_element("id", "phone")
field.send_keys("5551234567")
field.send_keys(Keys.ENTER)
This version calls send_keys() with lowercase letters and an underscore, which matches the method that Selenium exposes in the Python bindings. The final line also shows how to mix regular text and special keys by stacking calls or combining values in one call.
Confirm You Are Working With A Real Input Element
Sometimes a locator lands on the wrong part of the page. The error looks the same on the surface, yet the real issue lies in the HTML structure. A quick check of the tag name and attributes in your dev tools helps you confirm that your WebElement maps to something that can accept keystrokes.
- Check the tag name — Target fields that use tags such as
,
