When I am trying to run the below mentioned Selenium web driver code in IE 11 browser , I get below error
"Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == #text-input-what"
Code:
package com.indeed.tests;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class IndeedJobSearch {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Call the IE server to invoke IE browser
System.setProperty("webdriver.ie.driver","C:\\Users\\paulso\\Desktop\\Testing\\Automation\\Selenium Automation\\IEDriverServer_Win32_3.14.0\\IEDriverServer.exe");
// Create Internet explorer driver to driver the browser
WebDriver driver= new InternetExplorerDriver();
// Maximize the window server.
driver.manage().window().maximize();
// Open Indeed home page
driver.get("https://www.indeed.co.uk/");
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
// Find What field and enter Selenium
driver.findElement(By.id("text-input-what")).sendKeys("Selenium");
}
}
Error :(Console log)
Started InternetExplorerDriver server (32-bit) 3.14.0.0 Listening on port 8609 Only local connections are allowed Sep 20, 2018 11:31:15 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == #text-input-what For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
by.id
it makes no sense why the log would report it as an error with css selector. trydriver.findElement(By.xpath("//*[@id='text-input-what']")).sendKeys("Selenium");
which worked fine for me. – Bill Hileman Sep 20 '18 at 17:38