Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name='Name_First']"}


2 Answers 2


Wait until the element is there. I always wait for the first element on a page before interacting with it. FindElement() does not wait for the element, just gives an exception if it is not there.

Suggested is to use an explicit wait as described in this article: https://www.guru99.com/implicit-explicit-waits-selenium.html#3


There are two reasons for giving this error message:

  • Valid error, means that someone changed the page or deleted the element.
  • The page was not fully loaded hence selenium "throws" an error message

In your case I would assume that second case appears. This means that you should use wait condition e.g.:

WebDriverWait wait = new WebDriverWait(webDriver, timeoutInSeconds);

If wait is not working then it should be an errror in first case, then we would need to have a look at the DOM structure.

Please see also: NO such element

Not the answer you're looking for? Browse other questions tagged or ask your own question.