your code looks odd. typically, you locate an element, and then do actions with it... rather than locating it each time.
try something like this:
from selenium import webdriver
driver = webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
elem.send_keys('username')
Answer from Corey Goldberg on Stack OverflowGeeksforGeeks
geeksforgeeks.org › python › send_keys-element-method-selenium-python
send_keys() element method - Selenium Python - GeeksforGeeks
July 12, 2025 - # import webdriver from selenium import webdriver # create webdriver object driver = webdriver.Firefox() # get geeksforgeeks.org driver.get("https://www.geeksforgeeks.org/") # get element element = driver.find_element_by_id("gsc-i-id2") # send keys element.send_keys("Arrays")
Selenium
selenium.dev › documentation › webdriver › actions_api › keyboard
Keyboard actions | Selenium
July 29, 2025 - Keys.COMMAND : Keys.CONTROL; WebElement textField = driver.findElement(By.id("textInput")); new Actions(driver) .sendKeys(textField, "Selenium!") .sendKeys(Keys.ARROW_LEFT) .keyDown(Keys.SHIFT) .sendKeys(Keys.ARROW_UP) .keyUp(Keys.SHIFT) .keyDown(cmdCtrl) .sendKeys("xvv") .keyUp(cmdCtrl) .perform(); Assertions.assertEquals("SeleniumSelenium!", textField.getAttribute("value")); } } ActionChains(driver)\ .send_keys("abc")\ .perform()
selenium webdriver sendkeys() using python and firefox - Stack Overflow
After changing my selenium version the test was able to send_keys() and submit the form using send_keys(Key.ENTER) More on stackoverflow.com
python - Selenium - send keys - what element should I use - Stack Overflow
from selenium import webdriver from selenium.webdriver.common.keys import Keys driver=webdriver.Chrome() driver.get("site_name") driver.find_element_by_xpath('//body').send_keys(Keys.CONTROL+Keys.END) ... Sign up to request clarification or add additional context in comments. ... A simple javascript should be sufficient as well. Python ... More on stackoverflow.com
To send threekeys using send_keys() in selenium python webdriver - Stack Overflow
I am trying to type a float number into a textbox with default value 0.00.But it tries to get appended instead of overwriting it.I tried with .clear() and then send_keys('123.00') but still it gets More on stackoverflow.com
How to send keys with python selenium after an element has loaded? - Stack Overflow
Here I made an attempt of using ... before sending the keys. ... File "/home/wit/PycharmProjects/gmeet-automation/main.py", line 20, in username = driver.find_element(By.ID, 'identifierId') File "/home/wit/PycharmProjects/gmeet-automation/venv/git/google-meet-project/lib/python3.10/site-packages/selenium/webdriver... More on stackoverflow.com
What is the alternative to SendKeys in Selenium?
An alternative to SendKeys in Selenium is to use JavaScriptExecutor to set the value of an input field directly. This method is useful when sendKeys is too slow or fails to input text. Use “js.executeScript("arguments[0].value='text';", element)” to achieve this.
theknowledgeacademy.com
theknowledgeacademy.com › blog › selenium-send-keys
Selenium SendKeys: Automating Text Input in Web Testing
How to use XPath in Selenium?
XPath in Selenium is utilised for navigating through the HTML structure of a webpage to find elements. It’s a query language for selecting nodes from an XML document. Use “driver.findElement(By.xpath("your_xpath"))” to locate elements using either absolute or relative XPath expressions
theknowledgeacademy.com
theknowledgeacademy.com › blog › selenium-send-keys
Selenium SendKeys: Automating Text Input in Web Testing
What is the Knowledge Pass, and how does it work?
The Knowledge Academy’s Knowledge Pass, a prepaid voucher, adds another layer of flexibility, allowing course bookings over a 12-month period. Join us on a journey where education knows no bounds.
theknowledgeacademy.com
theknowledgeacademy.com › blog › selenium-send-keys
Selenium SendKeys: Automating Text Input in Web Testing
Videos
02:15
How to Use Selenium in Python to Send Emoji with send_keys Function ...
11:02
Selenium Python Tutorial Series #6 - How to send keys, click, and ...
03:19
How to Type Text or Send Keys in an Element or Dialog Box in Selenium ...
33:29
25 - Curso Selenium utilizando Python - Escribir Texto (Send_Keys) ...
04:04
alternative for send keys in selenium python - YouTube
03:42
Send keys directly to browser using Selenium with Python - YouTube
Selenium Python
selenium-python.readthedocs.io › getting-started.html
2. Getting Started — Selenium Python Bindings 2 documentation
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By driver = webdriver.Firefox() driver.get("http://www.python.org") assert "Python" in driver.title elem = driver.find_element(By.NAME, "q") elem.clear() elem.send_keys("pycon") elem.send_keys(Keys.RETURN) assert "No results found." not in driver.page_source driver.close()
Python Basics
pythonbasics.org › selenium-keyboard
selenium keyboard - Python Tutorial
The selenium webdriver starts the ... have a unique id). We grab the html element by its unique identifier like this: Then the method .send_keys() is used to type into the element....
Top answer 1 of 3
8
your code looks odd. typically, you locate an element, and then do actions with it... rather than locating it each time.
try something like this:
from selenium import webdriver
driver = webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
elem.send_keys('username')
2 of 3
2
Use following as a work around I think It may work.
driver = webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
app = Application.Application()
app.window_(title_re='*.Firefox.*').TypeKeys('username')
Last two lines are in Python(pyWinauto)
Top answer 1 of 3
5
This should be enough to make scroll to page bottom
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome()
driver.get("site_name")
driver.find_element_by_xpath('//body').send_keys(Keys.CONTROL+Keys.END)
2 of 3
3
A simple javascript should be sufficient as well. Python syntax
driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")
Top answer 1 of 4
20
I've had good results with:
from selenium.webdriver.common.keys import Keys
element.send_keys(Keys.CONTROL, 'a')
element.send_keys('123.00')
If that doesn't work it may have something to do with the code in the web page.
2 of 4
7
Unless you have custom editbox, click() should work for you:
from selenium.webdriver import Firefox
b = Firefox()
b.get('http://google.com')
e = b.find_element_by_id('lst-ib')
e.click() # is optional, but makes sure the focus is on editbox.
e.send_keys('12.34')
e.get_attribute('value')
# outputs: u'12.34'
e.click()
e.clear()
e.get_attribute('value')
# outputs: u''
e.send_keys('56.78')
e.get_attribute('value')
# outputs: u'56.78'
TutorialsPoint
tutorialspoint.com › article › send-keys-without-specifying-element-in-python-selenium-webdriver
Send keys without specifying element in Python Selenium webdriver
from selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") driver.implicitly_wait(0.5) driver.get("https://www.tutorialspoint.com/index.htm") #identify element with tagname l = driver.find_element_by_tag_name("input") l.send_keys("Selenium") #obtain value obtained print("Value entered: ") print(l.get_attribute('value')) driver.quit()
TutorialsPoint
tutorialspoint.com › how-do-i-send-a-delete-keystroke-to-a-text-field-using-selenium-with-python
How do I send a DELETE keystroke to a text field using Selenium with Python?
February 2, 2021 - l = driver.find_element_by_id("gsc−i−id1") l.send_keys("Sel") l.send_keys(Keys.CONTROL + 'a', Keys.BACKSPACE) Also, to use the Keys class, we have to add the import statement from selenium.webdriver.common.keys import Keys in our code.
Apidog
apidog.com › blog › send-keys-delay-in-selenium
How to Send Keys with Delay in Selenium (Easy Guide)
February 3, 2026 - There are several approaches to implementing delayed send keys in Selenium. We'll cover the most common and effective methods, starting with the simplest and progressing to more advanced techniques. The most straightforward method involves using a simple loop and Python's time.sleep() function.
Stack Overflow
stackoverflow.com › questions › 70422287 › how-to-send-keys-with-python-selenium-after-an-element-has-loaded
How to send keys with python selenium after an element has loaded? - Stack Overflow
Here I made an attempt of using the WebDriverWait function to allow time for the text box to be loaded before sending the keys. ... File "/home/wit/PycharmProjects/gmeet-automation/main.py", line 20, in <module> username = driver.find_element(By.ID, 'identifierId') File "/home/wit/PycharmProjects/gmeet-automation/venv/git/google-meet-project/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 1244, in find_element return self.execute(Command.FIND_ELEMENT, { File "/home/wit/PycharmProjects/gmeet-automation/venv/git/google-meet-project/lib/python3.10/site-packages/selenium
TutorialsPoint
tutorialspoint.com › typing-enter-return-key-in-selenium
Typing Enter/Return key in Selenium.
We can type Enter/Return key in Selenium. We shall use the sendKeys method and pass Keys. ENTER as an argument to the method. Also, we can use pass Keys. RETURN as an argument to the sendKeys method for the same purpose.