Try using CSS

WebElement element = new WebDriverWait(driver,30).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a[id*='DERIVED_REGFRM1_LINK_ADD_ENRL'][class='SSSBUTTON_CONFIRMLINK']")));
Answer from Yuvaraj HK on Stack Overflow
🌐
Quora
quora.com › How-do-you-handle-being-unable-to-locate-an-element-in-Selenium
How to handle being unable to locate an element in Selenium - Quora
Below is a compact, practical workflow and patterns to diagnose and resolve "element not found" issues. 1) Immediate checks (fast failures to rule out basics) Confirm the selector is correct: test the same CSS/XPath in browser DevTools (Elements ...
🌐
Google Groups
groups.google.com › g › selenium-users › c › OMgZGydnn0I
Xpath Correct but still get no such element: Unable to locate element:
My Xpath is correct & no iFrame and I can locate element in Chrome console but my program still fails. I have used explicit wait also. website http://newtours.demoaut.com/ I am trying to locate login page and send login id. ... 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']}
Discussions

java - I can't find Web element with xpath using driver.findElement(By.xpath()); - 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
Selenium can't locate element by xpath - Software Quality Assurance & Testing Stack Exchange
I am using Selenium and attempting to locate an element (table cell in a web app) by xpath. However, I am getting a NoSuchElementException when running my test cases. I am positive that the xpath More on sqa.stackexchange.com
🌐 sqa.stackexchange.com
November 16, 2018
Can't get element by XPATH
You're using an absolute xpath, which is almost always a bad idea. This xpath might work at one point, but it's also very prone to failure with even the slightest change in the page's DOM structure. Try coming up with an xpath that more uniquely identifies the element instead of tracing it all the way back to the html tag. More on reddit.com
🌐 r/selenium
4
2
December 4, 2021
automated testing - Unable to locate element using XPath getting NoSuchElementException - Software Quality Assurance & Testing Stack Exchange
I am unable to click on logout link in my web page using XPath. XPath: html/body/div[1]/span/div[1]/a[1] I See my code in an attachment: . More on sqa.stackexchange.com
🌐 sqa.stackexchange.com
July 2, 2018
🌐
Reddit
reddit.com › r/selenium › can't get element by xpath
r/selenium on Reddit: Can't get element by XPATH
December 4, 2021 -

Hello guys,

I'm trying to interact with the interative menu of this page in order to automate several data downloads instead of making it by hand.

The thing is that when I copy an XPATH of a selector (for example when I try to get the XPATH of the "Commodities" menu), selenium says:

Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[9]/div[1]/div[3]/ul/li[6]"}

Does anyone know why I can't get the element?

Thank you all in advance!

EDIT WITH SOLUTION:

The problem was that items I want to find are inside an iframe. So I have to switch the context of the webdriver first. Code with the solution:

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https://www.dukascopy.com/swiss/english/marketwatch/historical/')

table = driver.find_element(By.XPATH, '/html/body/div/main/div[2]/div/div/div/p[3]/iframe')

driver.switch_to.frame(table)

driver.find_element(By.XPATH, '/html/body/div[9]/div[1]/div[3]/ul/li[13]').click()

🌐
DEV Community
dev.to › liviufromendtest › how-to-fix-the-element-not-found-error-in-selenium-28gj
How to fix the "Element not found" error in Selenium - DEV Community
July 13, 2020 - When you instruct Selenium to look for an element, you provide a locator. A locator can be one of the following: • ID • Name • Class Name • XPath • CSS Selector • Tag Name • Partial Link Text • Link Text
Find elsewhere
🌐
Reddit
reddit.com › r/selenium › cannot find element by xpath although it is there.
r/selenium on Reddit: Cannot find element by XPATH although it is there.
June 3, 2023 -

Hey guys, new to the community and new to using Selenium. Can I please have some help? I am using Python and Selenium for navigating through a website. The website is turo.com; my goal is to login using my code.

So far, I am able to open the website, navigate to the "log in" button and click on it. After the login button is clicked, there is a modal that pops up with 2 input fields for email/user and password. I have the XPATH to the input fields but they are not working. I get the following error message:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"html/body/div[1]/form/div[1]/input[@id="email"]"}

Please let me know how to debug this error. I have tried stackoverflow and other forums but no answer so far. Thank you!

EDIT: I have tried using '//input[@data-testid="email"]' as well.

🌐
Reflect
reflect.run › articles › everything-you-need-to-know-about-nosuchelementexception-in-selenium
Everything you need to know about NoSuchElementException in Selenium | Reflect
In general, you should always try to use selectors and locator strategies that are based on the distinctive priorities of an HTML element. Styling and placement might change many times over time, and relying on them forces you to update your tests to avoid NoSuchElementExceptions. Let’s take a look at the three most common Selenium exceptions remaining. InvalidSelectorExceptionis thrown by By when the selector passed as a parameter is a CSS or XPath expression that is syntactically invalid.
🌐
GitHub
github.com › SeleniumHQ › selenium › issues › 14849
[🐛 Bug]: Cant find element using Xpath · Issue #14849 · SeleniumHQ/selenium
December 4, 2024 - OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//h1[@contenteditable='true' and @aria-label='Add title']"} (Session info: chrome=131.0.6778.86); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.Execute(String dr
Author   anugrahjayaaaa
🌐
Google Groups
groups.google.com › g › selenium-users › c › TTnYyJ6ijLE
Unable to read element in a iframe
... E (Driver info: chromedriv... this group or you need the view member email addresses permission to view the original message ... Your xpath for the title is incorrect....
🌐
qtpselenium
qtpselenium.com › selenium-training › forum › unable-to-locate-element-using-xpath-2933
Unable to locate element using XPATH | Selenium Forum
October 15, 2017 - i came to know that Its a hidden element. How to handle hidden webelement ? Below code is not working , please guide me what is not correct here? JavascriptExecutor Executor = (JavascriptExecutor) driver; WebElement hidden = driver.findElement(By.xpath(".//input[@class='inputtext'][@type='text']")); String script ="arguments[0].click();"; Executor.executeScript(script,hidden);
🌐
BrowserStack
browserstack.com › home › guide › find element by xpath in selenium in 2026
How to find element by XPath in Selenium [2026] | BrowserStack
December 19, 2025 - Many testers assume XPath in Selenium is easy—inspect an element, copy the XPath, and move on. I thought the same until a minor UI update broke half my tests in one run. Suddenly, every copied XPath failed, and I spent hours regenerating locators that kept breaking again.
🌐
GitHub
github.com › seleniumhq › selenium-google-code-issue-archive › issues › 5047
Unable to locate element: {"method":"xpath","selector":"//*[@id='usernameTextEdit']"} · Issue #5047 · SeleniumHQ/selenium-google-code-issue-archive
March 4, 2016 - ----------------------------------------------------------- public class Login { public static void main(String[] args) { WebDriver d1= new FirefoxDriver(); d1.navigate().to("http://inlv50795915s:8080/InfoViewApp"); d1.findElement(By.xpath("//*[@id='usernameTextEdit']")).sendKeys("administrator"); } } --------------------------------------------------------------- Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id='usernameTextEdit']"} Command duration or timeout: 188 milliseconds For documentation on this erro
Author   lukeis
🌐
TutorialsPoint
tutorialspoint.com › unable-to-locate-an-element-using-xpath-error-in-selenium-java
Unable to locate an element using xpath error in selenium-java
Add additional expected wait conditions for the element. Use an alternative xpath expression. 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.support.ui.Ex...