org.openqa.selenium.InvalidSelectorException

The xpath expression '//*[contains(@href,'javascript:void(0)')])[5]' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 93 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52' System info: host: 'lenovo-PC', ip: '192.168.0.21', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65' Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=9, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:42843/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] Session ID: 3a3aeacd-4d01-43ed-9e38-fd0dc081da63 *** Element info: {Using=xpath, value=//*[contains(@href,'javascript:void(0)')])[5]}


Solutions on the web9

Solution icon of github
documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52' System info: host: 'lenovo-PC', ip: '192.168.0.21', os.name: 'Windows 7

Solution icon of stackoverflow
information) Command duration or timeout: 77 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40' System

Solution icon of github
seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47' System info: host: 'NY12LP517735', ip

Solution icon of github
Locator Strategy 'name' is not supported for this session (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 8 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions

Solution icon of github
Locator Strategy 'name' is not supported for this session (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions

Solution icon of googlegroups
: TypeError: q is null Command duration or timeout: 7 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26

Solution icon of stackoverflow
via Stack Overflow by Farha
, 3 months ago
Given xpath expression "//*[@href='#' AND text()='Publish Now']" is invalid For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '3.3.1', revision: '5234b32', time

Solution icon of stackoverflow
invalid selector: Unable to locate an element with the xpath expression

Solution icon of stackoverflow
invalid selector: Compound class names not permitted. *** Element info: {Using=class name, value=swatch-option color}

Stack trace

  • org.openqa.selenium.InvalidSelectorException: The xpath expression '//*[contains(@href,'javascript:void(0)')])[5]' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 93 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52' System info: host: 'lenovo-PC', ip: '192.168.0.21', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65' Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=9, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:42843/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] Session ID: 3a3aeacd-4d01-43ed-9e38-fd0dc081da63 *** Element info: {Using=xpath, value=//*[contains(@href,'javascript:void(0)')])[5]} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353) at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:490) at org.openqa.selenium.By$ByXPath.findElement(By.java:361) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345) at readExcelData.Wschools.main(Wschools.java:19)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Once, 3 days ago