IE 11 "Unable to find element with xpath == //input[@id='lst-ib']"

252 views
Skip to first unread message

Victor

unread,
Jun 6, 2018, 10:32:56 PM6/6/18
to Selenium Users

S: Windows7

Selenium Version: selenium-java-3.12.0, IEDriverServer_x64_3.12.0, Java\jdk-10.0.1

Browser: Internet Explorer

Browser Version: IE 11.0.9600.19002

Expected Behavior -

Sending keys "a text" on google search text box

Actual Behavior -

Started InternetExplorerDriver server (64-bit)
3.12.0.0
Listening on port 7725
Only local connections are allowed
Jun. 06, 2018 4:02:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //input[@id='lst-ib']
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'W00000PC0S6APQ', ip: '10.190.235.43', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '10.0.1'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: true, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: true, ignoreZoomSetting: true, initialBrowserUrl: http://localhost:7725/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 34f22f93-226c-4397-bca9-4356f001bd5c
*** Element info: {Using=xpath, value=//input[@id='lst-ib']}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:317)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:419)
at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:309)
at RunTest.Openbrowser(RunTest.java:63)
at RunTest.main(RunTest.java:38)

Steps to reproduce -

/*

  • Pre-requisite: Protected Mode is not disabled and enabled consistently for all zones due to security setting. Added the 2 registry keys BFCACHE for 64bit instances of IE for a local 64bit machine.
    */

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;

public class RunTest {

private static String driverpath = new String("C:\\Data\\IEDriverServer_x64_3.12.0\\IEDriverServer.exe");
private static String targetURL = new String("http://www.google.com");

public static void main(String[] args) {
			
	Openbrowser ();	
	
}

private static void Openbrowser() {
	
	DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
	capabilities.setCapability("ie.ensureCleanSession", true);
	capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
            capabilities.setCapability("ignoreProtectedModeSettings", true);
	capabilities.setCapability("ignoreZoomSetting", true);
	capabilities.setJavascriptEnabled(true);
	
	File file = new File(driverpath);
	System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
	
	InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
    .usingDriverExecutable(new File(driverpath))
    .usingAnyFreePort()
    .build();
	
	@SuppressWarnings("deprecation")
	InternetExplorerDriver driver = new InternetExplorerDriver(service, capabilities);
	driver.switchTo().defaultContent();
	
	driver.get(targetURL);
	driver.findElement(By.xpath("//input[@id='lst-ib']")).sendKeys("a text");


	
}

}

Reply all
Reply to author
Forward
0 new messages