To enter text with Selenium, locate the editable element first, then call its element-level typing method: Java uses sendKeys("text"), while Python uses send_keys("text"). The target must be keyboard-interactable.
Enter text in a form field
Use a locator that identifies the field, then send the string to the resulting WebElement. These Java and Python examples follow Selenium’s official first-script form-entry flow; change the locator and text to match your page. See Selenium’s element interaction guidance and first-script examples.
Java
WebElement textBox = driver.findElement(By.name("my-text"));
textBox.sendKeys("Selenium");
Python
text_box = driver.find_element(by=By.NAME, value="my-text")
text_box.send_keys("Selenium")
After entering the text, a typical form workflow clicks the submit button and checks the page for a result. Locating the field and typing are separate actions: sendKeys is called on the element, not on the page or locator.
What sendKeys does—and what it needs
Selenium’s element method sends a sequence of keys to a keyboard-interactable element. Text inputs are common targets; an element with a contenteditable attribute may also accept keyboard input. A non-editable or otherwise non-interactable target can produce an invalid element state error.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
Element interactions are designed to emulate user interaction. Selenium’s interaction guidance says it scrolls an off-screen target into view and checks that it is interactable before acting.
When to use the Actions API instead
For ordinary text entry into a known field, the element-level method is the direct choice. Use the Actions API keyboard actions when keyboard input must be sequenced with pointer or other keyboard actions. Its sendKeys convenience action combines key-down and key-up behavior and differs slightly from calling the method on a WebElement.
Rank #2
Special cases: modifiers and file inputs
The JavaScript WebElement API reference documents sending a sequence of key arguments, including modifier keys such as Control, Shift, Alt, and Meta. A modifier can remain active until toggled, released with Key.NULL, or until the sequence ends.
The same API documents sending a path to a file input to select a file. With a remote Selenium server, the path must refer to a file on the browser machine; a file detector can transfer a local file. This file-input use is distinct from typing ordinary text into a form field.
Recommended Free Tools
Rank #3
Or skip the browser setup
If your goal is a screenshot rather than interacting with a form, ScreenshotNeo can return a website capture through one GET request. For example, this cURL call saves a WebP screenshot of the target URL:
Quick Recap
Best Value
Rank #4
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie and consent banners before capture and removes known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server gives AI agents tools for screenshots, page information, and PDFs. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




