Selenium Issue with Internet Explorer : org.openqa.selenium.NoSuchElementException : Unable to find element with xpath
Probably you need to use wait function until continueInput element is clickable on DOM page. Code below;
continueInput = WebDriverWait(driver,40).until(EC.element_to_be_clickable((By.XPATH, '//input[@value='Continue']')))
As you are trying to interact with just after get()
so to click()
on the desired element you need to induce WebDriverWait for the elementToBeClickable()
and you can use either of the following Locator Strategies:
cssSelector:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input[value='Continue']"))).click();
xpath:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Continue']"))).click();
Reference
You can find a detailed discussion on NoSuchElementException in:
This error message...
Started InternetExplorerDriver server (32-bit)3.9.0.0Listening on port 16289Only local connections are allowedJan 25, 2021 4:07:44 PM org.openqa.selenium.remote.ProtocolHandshake createSessionINFO: Detected dialect: W3CFAILED: testLogintoImmunizationLiveorg.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //input[@value='Continue'] (tried for 40 second(s) with 500 milliseconds interval)
...implies that the IEDriverServer was unable to locate the desired WebElement within the WebBrowsing Session i.e. InternetExplorer Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- Though your Selenium standalone server version is 3.141.59 which is the latest released candidate.
- But your InternetExplorerDriver version is 3.9.0.0.
So there is a clear mismatch between the Selenium standalone server v3.141.59 and InternetExplorerDriver v3.9.0.0. As per best practices as Selenium Client and InternetExplorerDriver are released in sync you must use both the binaries from the same release.
Additional Information
Further InternetExplorerDriver server v3.9.0.0 had a known issue as per the following references:
- Can't launch Selenium IE Driver after upgrading to version 3.9
- Selenium Java Client (v3.9.1) with IEDriverServer v3.9.0.0 (64-bit) crashes with org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28286
This issue have been addressed through the following commit:
Solution
- Upgrade JDK to current levels JDK 8u271.
- Upgrade Selenium to current levels Version 3.141.59.
- Upgrade IEDriverServer to latest IEDriverServer v3.150.1 level.
Note: As per best practices as Selenium Client and InternetExplorerDriver are released in sync and you must try to use both the binaries from the same major release.
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- Execute your
@Test
. - Always invoke
driver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.