Before calling SendKeys, make sure your locator identifies the actual editable field and wait until that field is displayed. Finding an element in the DOM does not mean it is visible or ready for keyboard input. If the page reveals the field after a click, tab change, or modal action, do that first, then wait for the displayed field and type.
What the error means—and what to check first
Selenium can locate an element that a user cannot currently see or type into. A locator returning an element proves that Selenium found a matching DOM node; it does not prove that the node is displayed, editable, or the correct target. Selenium’s official waits guidance says an element must be present and displayed before Selenium can interact with it. Its interaction guidance describes sending keys to text fields and keyboard-interactable elements, and checking interactability before acting.
Start with the locator, not with a workaround. Confirm that it points to the actual input, textarea, or other keyboard-interactable control—not a label, wrapper, hidden template, or duplicate field. A custom-looking form can have a visible label or container while its real input is elsewhere or still hidden.
Visibility and editability are different checks
An element may exist but be hidden. It may also be displayed without being an appropriate keyboard target—for example, a non-editable element. In the latter case Selenium may report an invalid element state or another interaction error rather than a visibility-specific exception. Use the complete exception message to distinguish these situations.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems#1 Best Overall
“Element not visible” may not be the current exception name
Older code and explanations often refer to ElementNotVisibleException. Current Selenium interaction documentation uses broader element not interactable failure categories, including targets that are not displayed, outside the viewport, or not keyboard-interactable. The exact exception depends on the installed Selenium package, browser, driver, and condition. Do not assume that two differently worded errors are identical without inspecting the full message and environment.
Wait for the field to be displayed before typing
For a field that is already on the page but becomes visible asynchronously, use an explicit wait for the displayed state. This Selenium 4-style C# example locates the field during the wait and returns it only when its Displayed property is true:
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var field = wait.Until(d =>
{
var element = d.FindElement(By.Id("email"));
return element.Displayed ? element : null;
});
field.SendKeys("[email protected]");
Replace By.Id("email") with the locator for the real field and choose a timeout suited to the application and test environment. This is an illustrative pattern, not a guarantee for every page. Use the WebDriverWait constructor and support package appropriate to the Selenium .NET version installed in your project.
If the element is not yet present at all, FindElement can throw while the wait is polling. In that case, use a wait condition that treats the not-yet-present state as a reason to keep waiting, or use the expected-condition helpers available in your installed Selenium support package. The key requirement is that the condition be retried until the target is both found and displayed; do not catch errors so broadly that genuine locator or application failures are hidden.
When an action reveals the field
Perform the user action that reveals the control before starting the visibility wait. For example, click the tab or button that opens a form, wait for the input to become displayed, then call SendKeys. Waiting before the transition can waste the timeout or accidentally match a different hidden field.
driver.FindElement(By.Id("open-profile-form")).Click();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var nameField = wait.Until(d =>
{
var element = d.FindElement(By.Name("displayName"));
return element.Displayed ? element : null;
});
nameField.SendKeys("Avery");
The document being ready does not necessarily mean that application JavaScript has finished changing the page. Synchronize on the state the test needs—the displayed field—rather than assuming page readiness implies form readiness.
Diagnose the failure in a reliable order
- Verify the target. Inspect the locator and the matched element. Make sure it is the editable control, not its label, parent container, hidden clone, or another matching field. If the locator can match more than one element, identify which match is visible and intended rather than relying on an accidental first match.
- Reproduce the page transition. If the field appears after a modal, tab, click, or script-driven change, make that transition in the test before waiting. Check that the action succeeded and that the expected part of the form opened.
- Wait for the state you need. Wait for the actual field to report
Displayedbefore typing. A fixed sleep is not a substitute for a condition: it can be too short on a slow run and unnecessarily long on a fast one. - Confirm it can receive text. If it is displayed but typing still fails, verify that it is an editable text control and inspect the precise exception. Visibility alone does not make an arbitrary element a keyboard target.
- Check for a rerender. If the page replaced the element after a transition, discard the old reference and locate the field again after the rerender. A stale-element failure means the reference is no longer valid in the DOM; it is a different problem from a field that is merely hidden.
- Record the environment and full error. Keep the exception type and message, locator, Selenium .NET version, browser, and driver version with the failure. This makes it possible to tell a visibility problem from an invalid state, stale reference, or other interaction failure.
Choose a fix that preserves the test’s meaning
| Remedy | When it fits | What it verifies |
|---|---|---|
| Correct the locator | The match is a wrapper, label, hidden copy, or wrong field. | The test targets the real editable control. |
| Wait for displayed state | The correct control appears after page code or a user action runs. | The test synchronizes with the UI state required for typing. |
| Locate again after a rerender | The page replaces the node during an update. | The test uses a reference to the current DOM element. |
| Assign a value with JavaScript | Not established as a reliable replacement for this unknown page. | It may bypass normal WebDriver keyboard interaction, so it may not test the same behavior as a user typing. |
Prefer ordinary WebDriver interaction after correcting the target and timing. Directly assigning a value through JavaScript may bypass the interaction path the test is meant to exercise; the available guidance does not establish it as a reliable fix for an unspecified page.
Common symptoms and fixes
The locator succeeds, but SendKeys fails immediately
The element may be in the DOM but hidden, or the locator may select a non-editable node. Inspect the matched element and wait for its displayed state. If it is the wrong node, change the locator instead of extending the wait.
The failure happens only after opening a modal or switching tabs
The field may not be displayed until the transition completes. Perform the click or tab change first, then wait for the field itself. Do not reuse a reference acquired before the page changed if the transition rerenders the form.
Rank #4
The test passes locally but fails intermittently
Intermittent timing is a reason to synchronize with a condition, not to add an arbitrary delay. Wait for the specific field to be displayed after the relevant transition. If failures persist, capture the full exception and verify that the locator has not begun matching a different element in one of the page states.
The error changes to stale element
A stale reference indicates that the original DOM node is no longer valid, often because the page updated or replaced it. Locate the field again after that update, then wait for the new element to be displayed. Increasing the visibility wait without refreshing an invalid reference does not solve staleness.
The element is displayed but still will not accept keys
Check whether the target is actually a text field or keyboard-interactable control and whether the exception describes an invalid state rather than invisibility. A displayed label, container, or read-only/non-editable target is not made typeable by waiting longer.
Recommended Free Tools
Best Value
Or skip the browser setup
If your task is to capture a page screenshot rather than test text entry, ScreenshotNeo provides a screenshot API and MCP server. It does not fix Selenium interaction errors or replace a test that must enter text through WebDriver. For page captures, its request can return an image or PDF without you setting up browser automation locally.
With an API key, make one GET request:
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 parameters. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture by default, with each step configurable. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing; the response identifies the page verdict and billing status in headers. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card.
Keep the test stable as the page changes
- Use a locator that identifies the field by a stable property supplied by the application, rather than a broad selector that can match hidden and visible copies.
- Wait after the action that causes the field to appear, and wait for the field—not merely the document—to reach the state needed by the next step.
- Acquire a fresh element reference after page updates that replace DOM nodes.
- Keep the complete exception and relevant browser, driver, and Selenium package versions when diagnosing a failure.
- Use normal
SendKeysinteraction when the test is intended to validate keyboard entry.
Frequently Asked Questions
Should I increase the timeout whenever this error occurs?
Only if the field is correctly targeted and the page genuinely needs more time to reveal it. A longer timeout cannot correct a locator that selects the wrong or non-editable element.
Does this error identify a specific Selenium C# version?
No. The title and error wording alone do not establish the installed .NET package version. Check the project’s package version and use API signatures supported by that version.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
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.

