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

98 views
Skip to first unread message

Veranika Ivanova

unread,
Apr 17, 2015, 3:54:32 AM4/17/15
to seleniu...@googlegroups.com
Hi all,

I send  http call in browser to log out from application and then xml response opens in browser. I need to check tag value in this response.

Page source code is:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <result type="boolean">true</result>
</hash>

I search an element by xPath //*[text()='true']

When I launch this test in FF 34.0 with selenium 2.44.0, everything is OK
But when I try in FF 37.0 with selenium 2.45.0 I'm getting the following error:

07:22:47.776 INFO - Executing: [find element: By.xpath: //*[text()='true']])
07:22:47.950 WARN - Exception thrown
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}]
        at sun.reflect.GeneratedConstructorAccessor30.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 sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
        at com.sun.proxy.$Proxy1.findElement(Unknown Source)
        at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:184)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:47)
        at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.openqa.selenium.InvalidSelectorException: The given selector //*[text()='true'] is either invalid or does no
 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
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html

I checked this xPath in Firebug and it works. I aslo tried to use //*, //result[text()='true'] and I always get such error.
Have you any ideas what it could be caused by? 
Is this selenium issue or my xPath is really invalid?

Thank you in advance,
Veranika

Musaffir Lp

unread,
Aug 22, 2015, 10:36:25 AM8/22/15
to Selenium Users
Looks liks it an issue with 2.45.0
can you try with selenium 2.46 and update ..

Vladyslav Lopatynskyi

unread,
Aug 24, 2015, 2:32:07 AM8/24/15
to Selenium Users
Try to set Implicit wait for your webDriver instance. 
It looks like you don't have it at all.  (Command duration or timeout: 7 milliseconds)

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Seems selenium tried to reach element before it has been appeared
Reply all
Reply to author
Forward
0 new messages