org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression xpath=(//button[@type='button'])[17] because of the following error: TypeError: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type. (Session info: chrome=51.0.2704.103) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace 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 info: host: 'OLCZPR112319', ip: '10.99.133.77', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\Users\MNXE\AppData\Local\Temp\scoped_dir1332_417}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 8d72512617454899692b23a3f15ade99 *** Element info: {Using=xpath, value=xpath=(//button[@type='button'])[17]}

Stack Overflow | bluemunch | 5 months ago
  1. 0

    InvalidSelectorException when selecting XPath button with Selenium

    Stack Overflow | 5 months ago | bluemunch
    org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression xpath=(//button[@type='button'])[17] because of the following error: TypeError: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type. (Session info: chrome=51.0.2704.103) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace 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 info: host: 'OLCZPR112319', ip: '10.99.133.77', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\Users\MNXE\AppData\Local\Temp\scoped_dir1332_417}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 8d72512617454899692b23a3f15ade99 *** Element info: {Using=xpath, value=xpath=(//button[@type='button'])[17]}
  2. 0

    InvalidSelectorException caused by TypeError: q is null with FF 37.0.1 and Selenium 2.45.0

    Google Groups | 2 years ago | Veranika Ivanova
    org.openqa.selenium.InvalidSelectorException: The given selector //*[text()='true'] is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression //*[text()='true'] because of the following err r: 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 23:59:50' *** Element info: {Using=xpath, value=//*[text()='true']} Session ID: 21afcdd7-ffae-453d-8463-3bec9da0532c Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=tru , browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnab ed=true, applicationCacheEnabled=true, takesScreenshot=true, version=37.0.1}]
  3. 0

    Sporadic (InvalidSelectorException) type error thrown: TypeError: Failed to execute 'createNSResolver' on 'Document': parameter 1 is not of type 'Node'

    GitHub | 1 year ago | irileydev
    org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //label[contains(text(), 'SOP Hub')] because of the following error: TypeError: Failed to execute 'createNSResolver' on 'Document': parameter 1 is not of type 'Node'. (Session info: chrome=43.0.2357.130) (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 3.26 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: '165.181.224.155', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_25' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\ISAAC~1.RIL\AppData\Local\Temp\scoped_dir9056_16605}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=43.0.2357.130, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: bf09f86741c93e3efb5f7bb68567bf77 **\* Element info: {Using=xpath, value=//label[contains(text(), 'SOP Hub')]}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to click an element in xpath and selenium having option-id element but same div class?

    Stack Overflow | 1 month ago | user2325154
    org.openqa.selenium.InvalidSelectorException: invalid selector: Compound class names not permitted. *** Element info: {Using=class name, value=swatch-option color}
  6. 0

    org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this session (WARNING: The server did not provide any stacktrace information)

    GitHub | 6 months ago | xiaominghou
    org.openqa.selenium.InvalidSelectorException: 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/invalid_selector_exception.html Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44' System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.7.0_79' *** Element info: {Using=name, value=myTab} Session ID: 13034d14-2ef4-4ea1-b46a-635f9832047b Driver info: io.appium.java_client.ios.IOSDriver Capabilities [{platform=MAC, app=/Users/xiaoming/aaa.ipa, javascriptEnabled=true, browserName=, networkConnectionEnabled=false, desired={app=/Users/hichao/test/mxyc_auto_test/apps/mxyc.ipa, platformVersion=8.3, deviceName=xiaoming, platformName=iOS, appiumVersion=1.0, unicodeKeyboard=true, resetKeyboard=true, udid=ac76963a56e13d8afeae83d3bb33a7f2c826b48a}, udid=ac76963a56e13d8afeae83d3bb33a7f2c826b48a, locationContextEnabled=false, platformVersion=8.3, databaseEnabled=false, platformName=iOS, deviceName=xiaoming, appiumVersion=1.0, webStorageEnabled=false, unicodeKeyboard=true, resetKeyboard=true, takesScreenshot=true}]

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.openqa.selenium.InvalidSelectorException

      invalid selector: Unable to locate an element with the xpath expression xpath=(//button[@type='button'])[17] because of the following error: TypeError: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type. (Session info: chrome=51.0.2704.103) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace 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 info: host: 'OLCZPR112319', ip: '10.99.133.77', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\Users\MNXE\AppData\Local\Temp\scoped_dir1332_417}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 8d72512617454899692b23a3f15ade99 *** Element info: {Using=xpath, value=xpath=(//button[@type='button'])[17]}

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
    2. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      4 frames
    3. Selenium
      RemoteWebDriver.findElementByXPath
      1. org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
      2. org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
      3. org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
      4. org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
      5. org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
      5 frames
    4. selenium-api
      By$ByXPath.findElement
      1. org.openqa.selenium.By$ByXPath.findElement(By.java:361)
      1 frame
    5. Selenium
      RemoteWebDriver.findElement
      1. org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
      1 frame
    6. Unknown
      ValidationTest.testValidation
      1. ValidationTest.clickXPathButtonAndWait(ValidationTest.java:124)
      2. ValidationTest.parseStory(ValidationTest.java:152)
      3. ValidationTest.testValidation(ValidationTest.java:73)
      3 frames
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    8. JUnit
      ParentRunner.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      6. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      7. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      9. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      10. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      11. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      12. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      13. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      14. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      15. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      15 frames
    9. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      1 frame
    10. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      5 frames