Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.
To type into a text box using Selenium, you can use the send_keys() method of theWebElement class. Here is an example Python code snippet to type "Hello, World!" into a text box:
from selenium import webdriver
# Instantiate a WebDriver object
driver = webdriver.Chrome()
# Navigate to a webpage with a text box
driver.get("https://example.com")
# Find the text box element
text_box = driver.find_element_by_id("textbox-id")
# Type "Hello, World!" into the text box
text_box.send_keys("Hello, World!")
# Close the browser window
driver.quit()
In this example, we first instantiate a WebDriver object and navigate to a webpage with a text box. Then we find the text box element using its id attribute and use the send_keys() method to type "Hello, World!" into the text box. Finally, we close the browser window using the quit() method of the WebDriver object.
Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.
Start Free TestingEarn resume-worthy Selenium certifications that help you land a top job.
Learn MoreTest orchestration and execution cloud of 3000+ browsers and OS
24/7 support
Enterprise grade security
Fastest test execution cloud