TypeError: Failed to execute 'createNSResolver' on 'Document': parameter 1 is not of type 'Node'
Asked Answered
S

2

10

I'm using Cucumber with Watir Web-driver and Chrome browser. When I execute my tests, sometimes there is an error like this:

"Selenium::WebDriver::Error::InvalidSelectorError: invalid selector: Unable to locate an element with the xpath expression //a[contains(., 'Joao Moreira')] 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.81) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)"

I tried to get an answer trough Google but with no success.

Schluter answered 4/6, 2015 at 10:39 Comment(5)
same here: definitely sporadic, noticed it soon after upgrading to selenium 2.45Fairtrade
I have had this while running 2.44, and with Chromedriver 2.14 and 2.15. My feeling is that it happened when Chrome upgraded to 43Glance
Out of interest, is there a pattern on what the browser is doing when this occurs?Glance
In my case it is switching between frame windowsRondure
Just to add data points: Selenium 2.46 and Chrome 44 and it is sporadic but often enough.Secretarygeneral
R
1

Pretty sure this is this issue here: https://code.google.com/p/selenium/issues/detail?id=8600

And it is fixed as of Selenium 2.46.0. I haven't seen the error since moving.

Rondure answered 19/6, 2015 at 20:37 Comment(0)
C
0

Add a line to handle the exception thrown. Seems like the error halts the test. This has nothing to do with the locator, or iframe.Try to wrap your method in rescue clause:

begin
 {your method}
rescue
     Selenium::WebDriver::Error::InvalidSelectorError
end 
Condensation answered 4/8, 2015 at 21:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.