Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Dom exceptions with capybara 2.1 #510

Closed
mariovisic opened this issue Apr 15, 2013 · 4 comments
Closed

Dom exceptions with capybara 2.1 #510

mariovisic opened this issue Apr 15, 2013 · 4 comments

Comments

@mariovisic
Copy link

After upgrading to capybara 2.1 and running on the HEAD version of capybara-webkit, i'm running into some errors.

One in particular seems to occur for CSS selectors that are more than 1 level deep, eg this fails:

find('.list-items .list-item:first')

The error Capybara::Webkit::InvalidResponseError: SYNTAX_ERR: DOM Exception 12 is thrown

changing the code to this seems to work fine:

find('.list-items').first('.list-item')
@mhoran
Copy link
Collaborator

mhoran commented Apr 15, 2013

As of Capybara 2.1, CSS selectors are no longer translated to XPath via Nokogiri. :first is not a valid CSS selector, but it seems that Nokogiri translates this to an appropriate XPath query. Given that CSS selectors are now evaluated natively (not translated to XPath), you'll want to use something like :first-child, or whatever is appropriate.

@mhoran mhoran closed this as completed Apr 15, 2013
@mariovisic
Copy link
Author

@mhoran thanks for the explanation :)

@tmorris-fiksu
Copy link

Make sure to see the discussion here: teamcapybara/capybara@4f805d5
for a work-around to make your transition to 2.1 easier if you have this problem.

@ziemekwolski
Copy link

Thank you so much for posting this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants