Error in IE for Not valid Xpath whiel chrome its fine | Selenium Forum
M
Posted on 09/11/2015
Hi
I am getting an issue in the IE while is is working fine in the Chrome
is a xapth is working fine in Chrome its shows error on IE
PFA Script-->

import java.util.concurrent.TimeUnit;
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.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class ScriptIE {

public static void main(String[] args) {
System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer.exe");
WebDriver driver=new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://www.makemytrip.com/holidays/international/search?depCity=&isDestHoliday=true&selectedTabName=&dest=Mauritius&channel=onsite&intid=OBTLP_row1a_OBT_Mauritius_10092015");

WebElement CityBox=driver.findElement(By.xpath("//input[@class='flL dept_city_input fontSize11 RobotoLight ui-autocomplete-input']"));
CityBox.sendKeys("New Delhi");
driver.findElement(By.xpath("//*[@id='selectCity_btn']")).click();

}

}


Error on the Console---->

Started InternetExplorerDriver server (32-bit)
2.48.0.0
Listening on port 8516
Exception in thread "main" org.openqa.selenium.InvalidSelectorException: The xpath expression '//input[@class='flL dept_city_input fontSize11 RobotoLight ui-autocomplete-input']' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.92 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'DS-38607722D0E8', ip: '10.112.129.148', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_79'
Session ID: 70be1255-94f8-456c-be3a-456f8f4b7527
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=9, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreProtectedModeSettings=false, cssSelectorsEnabled=true, requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:8516/, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at ScriptIE.main(ScriptIE.java:18)

M
Replied on 10/11/2015

iedriver has bugs try to use it on chrome or firefox.