After you clicked loginenter button, some wait should be added to reload page. It will provide small delay which is helpful for SeleniumDriver to identify element. I would like to suggest you to add some condition to wait next element. Please try below code snippet

WebElement myDynamicElement = 
(new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.id("usrUTils")));
Answer from Yursev on Stack Exchange
🌐
Selenium
selenium.dev › documentation › webdriver › troubleshooting › errors
Understanding Common Errors | Selenium
This issue cannot always be resolved on the user’s end, however when it can it is usually solved by the following: using an explicit wait, or interacting with the page in such a way to make the element visible (scrolling, clicking a button, etc.)
Discussions

Selenium always gives org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: - Stack Overflow
The text "Congratulations!" apprears on the site only when the transaction is successful. I am trying to capture the text of this element using JavascriptExecutor as the type is set to hi... More on stackoverflow.com
🌐 stackoverflow.com
java - org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element - Stack Overflow
But remember, if you try to locate another Element that is not in the iframe you will need to switch back to the default content like this: ... One quality every engineering manager should have? Empathy. ... Join us for our first community-wide AMA (Ask Me Anything) with Stack... bigbird and Frog have joined us as Community Managers ... Is it better to redirect users who attempt to perform actions they can't yet... ... 1 OpenQA.Selenium.NoSuchElementException... More on stackoverflow.com
🌐 stackoverflow.com
webdriver - org.openqa.selenium.NoSuchElementException: no such element - Stack Overflow
Running Selenium WebDriver 2.37.1 I'm receiving an intermittent problem when running a test and receive the following error: org.openqa.selenium.NoSuchElementException: no such element Sometimes... More on stackoverflow.com
🌐 stackoverflow.com
org.openqa.selenium.NoSuchElementException no such element: Unable to locate element - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
🌐 stackoverflow.com
🌐
Google Groups
groups.google.com › g › selenium-users › c › OMgZGydnn0I
Xpath Correct but still get no such element: Unable to locate element:
PASSED: openURL FAILED: loginToTours **org.openqa.selenium.NoSuchElementException**: **no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name='userName']"}** *** Element info: {Using=xpath, value=//input[@name='userName']} package SeleniumPracticePackage; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWa
🌐
BugBug
bugbug.io › blog › software testing
How to Handle NoSuchElementException in Selenium?
January 16, 2026 - You can use the throw statement in Java to manually trigger the NoSuchElementException. For instance, if a condition is not met (such as an element not being found), you can throw the exception to simulate an error. import org.openqa.seleni...
🌐
Stack Overflow
stackoverflow.com › questions › 64053291 › selenium-always-gives-org-openqa-selenium-nosuchelementexception-no-such-elemen
Selenium always gives org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: - Stack Overflow
You can then get the element's text by doing: ele.getAttribute("innerHTML"); ... No luck even after making the changes in the xpath and implementing webdriverwait. WebDriverWait wait = new WebDriverWait(driver, 20); WebElement ele = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(text(),'Congratulations')]"))); String text = ele.getAttribute("innerHTML"); System.out.println(text); ... org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.xpath: //*[contains(text(),'Congratulations')] (tried for 20 second(s) with 500 milliseconds interval)
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › software testing › understanding-no-such-element-exception-in-selenium
Understanding No Such Element Exception in Selenium - GeeksforGeeks
July 23, 2025 - If it is not found, the NoSuchElementException is caught. The implicit waits is tells WebDriver to wait for the certain amount of the time when trying to the locate an element before throwing the exception.
🌐
Google Groups
groups.google.com › g › selenium-users › c › NBtdYTvh8OY
Unable to locate element Error using Webdriver
On May 27, 7:15 am, Bhavana Thati <bhavana.th...@gmail.com> wrote: > Hi All, > > I'm getting below exception while working on selenium webdriver. This > exception occurs when I use xpath, linktext or class name or label name etc. > Also it is inconsistent exception as it works sometimes and fails mostly. > > *org.openqa.selenium.NoSuchElementException*: {"method":"class
Top answer
1 of 2
3

You should be using dynamic selectors. http://pragmatictestlabs.com/2018/05/16/mastering-xpath-for-selenium-test-automation/

This is certainly a tough xpath if you're just starting but if you want to click the "Business" button in the header it would be:

driver.findElement(By.xpath("//header[@id='header-nav-container'] //div[contains(@class,'NavGrid')] [not(@style='false:unset')]//a[text()='Business']"));

As for all the error messages, I'm not sure why it's throwing them. What's missing actually is the Exception that should be thrown when the findElement method failed. I believe it should be a NoSuchElement Exception.

Can you surround your code with a try/catch block and throw an Exception like so:

try {
//code
} catch (Exception e) {
System.out.println(e) 
}

EDIT: Actually, it is throwing the NoSuchElementException. I guess Geckodriver throws it in the midst of other log entries. Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: /html[1]/body[1]/div[5]/div[1]/div[1]/header[1]/div[1]/div[1]/div[1]/div[2]/nav[1]/ul[1]/li[3]/a[1]

2 of 2
0

To extract the text Business you need to induce WebDriverWait for the visibilityOfElementLocated() and you can use either of the following Locator Strategies:

  • cssSelector:

    System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("li[data-section='business']>a[name='business'][data-analytics='header_top-nav']"))).getText());
    
  • xpath:

    System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@data-section='business']/a[@name='business' and @data-analytics='header_top-nav']"))).getText());
    
🌐
Selenium
selenium.dev › selenium › docs › api › java › org › openqa › selenium › NoSuchElementException.html
Class NoSuchElementException
org.openqa.selenium.NoSuchElementException · All Implemented Interfaces: Serializable · public class NoSuchElementException extends NotFoundException · Thrown by WebDriver.findElement(By by) and WebElement.findElement(By by). See Also: Serialized Form · BASE_SUPPORT_URL, DRIVER_INFO, SESSION_ID ·
🌐
Quora
quora.com › How-do-I-resolve-NoSuchElementException-in-Selenium-Java
How to resolve NoSuchElementException in Selenium Java - Quora
Answer: It is as simple as Exception ...nium.NoSuchElementException So again, to resolve this you have to help- Selenium recognizing the element you intended....
🌐
LambdaTest
lambdatest.com › automation-testing-advisor › selenium › classes › org.openqa.selenium.NoSuchElementException
Use org.openqa.selenium.NoSuchElementException in Selenium With Examples | LambdaTest
NoSuchElementException e) {41 e.printStackTrace();42 }43 return dropdown; 44 }45 46 public static Select displayDOBYearDropDown() throws Exception47 {48 try {49 dropdown = new Select(driver.findElement((properties.selectLocator("Step1_SelectYearDropdown"))));50 } catch (org.openqa.selenium. NoSuchElementException e) {51 e.printStackTrace();52 }53 return dropdown; 54 }55 56 public static WebElement displayDaysOfMonthInDoB() throws Exception57 {58 try {59/​/​ WEBDRIVERWAIT WAIT = NEW WEBDRIVERWAIT(DRIVER, 30);60/​/​ wait.until(ExpectedConditions.visibilityOfElementLocated(properties.selectLocator("Step1_DayOfMonth")));61/​/​ element = driver.findElement(properties.selectLocator("Step1_DayOfDateOfBirth"));62 element = driver.findElement(By.xpath("./​/​a[contains(text(),'"+dayInDob+"')]"));63 } catch (org.openqa.selenium.
Top answer
1 of 4
45

NoSuchElementException

org.openqa.selenium.NoSuchElementException popularly known as NoSuchElementException extends org.openqa.selenium.NotFoundException which is a type of WebDriverException.

NoSuchElementException can be thrown in 2 cases as follows :

  • When using WebDriver.findElement(By by) :

    //example : WebElement my_element = driver.findElement(By.xpath("//my_xpath"));
    
  • When using WebElement.findElement(By by) :

    //example : WebElement my_element = element.findElement(By.xpath("//my_xpath"));
    

As per the JavaDocs just like any other WebDriverException, NoSuchElementException should contain the following Constant Fields :

Constant Field      Type                                        Value
SESSION_ID          public static final java.lang.String        "Session ID"
e.g. (Session info: chrome=63.0.3239.108)

DRIVER_INFO         public static final java.lang.String        "Driver info"
e.g. (Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 6.1.7601 SP1 x86)

BASE_SUPPORT_URL    protected static final java.lang.String     "http://seleniumhq.org/exceptions/"
e.g. (For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html)

Reason

The reason for NoSuchElementException can be either of the following :

  • The Locator Strategy you have adopted doesn't identifies any element in the HTML DOM.
  • The Locator Strategy you have adopted is unable to identify the element as it is not within the browser's Viewport.
  • The Locator Strategy you have adopted identifies the element but is invisible due to presence of the attribute style="display: none;".
  • The Locator Strategy you have adopted doesn't uniquely identifies the desired element in the HTML DOM and currently finds some other hidden / invisible element.
  • The WebElement you are trying to locate is within an <iframe> tag.
  • The WebDriver instance is looking out for the WebElement even before the element is present/visibile within the HTML DOM.

Solution

The solution to address NoSuchElementException can be either of the following :

  • Adopt a Locator Strategy which uniquely identifies the desired WebElement. You can take help of the Developer Tools (Ctrl+Shift+I or F12) and use Element Inspector.

    Here you will find a detailed discussion on how to inspect element in selenium3.6 as firebug is not an option any more for FF 56?

  • Use executeScript() method to scroll the element in to view as follows :

    WebElement elem = driver.findElement(By.xpath("element_xpath"));
    ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", elem);
    

    Here you will find a detailed discussion on Scrolling to top of the page in Python using Selenium

  • Incase element is having the attribute style="display: none;", remove the attribute through executeScript() method as follows :

    WebElement element = driver.findElement(By.xpath("element_xpath"));
    ((JavascriptExecutor)driver).executeScript("arguments[0].removeAttribute('style')", element)
    element.sendKeys("text_to_send");
    
  • To check if the element is within an <iframe> traverse up the HTML to locate the respective <iframe> tag and switchTo() the desired iframe through either of the following methods :

    driver.switchTo().frame("frame_name");
    driver.switchTo().frame("frame_id");
    driver.switchTo().frame(1); // 1 represents frame index
    

    Here you can find a detailed discussion on Is it possible to switch to an element in a frame without using driver.switchTo().frame(“frameName”) in Selenium Webdriver Java?.

  • If the element is not present/visible in the HTML DOM immediately, induce WebDriverWait with ExpectedConditions set to proper method as follows :

    • To wait for presenceOfElementLocated :

      new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@class='buttonStyle']//input[@id='originTextField']")));
      
    • To wait for visibilityOfElementLocated :

      new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='buttonStyle']//input[@id='originTextField']")));
      
    • To wait for elementToBeClickable :

      new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='buttonStyle']//input[@id='originTextField']")));
      

Reference

You can find Selenium's python client based relevant discussion in:

  • Selenium “selenium.common.exceptions.NoSuchElementException” when using Chrome
2 of 4
3

Your code is correct, I suspect the issue caused the page not complete load when you find the element.

Try add a long sleep before find element, if adding sleep worked, change sleep to wait.

Here is the code, It means waiting 10s if the element isn’t present:

element = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.ID, "originTextField"))
)
🌐
Google Groups
groups.google.com › g › webdriver › c › cQrbtyYvK_0
org.openqa.selenium.NoSuchElementException: Unable to locate element
The other problem is that you are switching to the first IFRAME then trying to find the element with XPath "//*[@id='document.documentHeader.documentDescription']". If this element is not on the first IFRAME it will fail with NoSuchElementException.
🌐
Reflect
reflect.run › articles › everything-you-need-to-know-about-nosuchelementexception-in-selenium
Everything you need to know about NoSuchElementException in Selenium | Reflect
There are two main reasons for a NoSuchElementException: The Selenium locator strategy you adopted does not identify any HTML element in the DOM.