What library does Capybara use as CSS selector?
-
29-09-2019 - |
Question
For my acceptance tests I use Steak and Capybara (+ Envjs).
When trying to find an element like this find("#ticker").find("li:eq(0)")
it tells me Unable to find 'li:eq(0)'
, but find("#ticker").find("li:eq(1)")
return the correct first li
element in the list.
I am used to that eq selector starts with 0 (jQuery). Why does eq selector in Capybara starts with 1? Bug or feature?
Update
It seems that it is some unofficial selector which works like nth-child
. What does Capybara (/Envjs) use under the hood for selectors? It doesn't seem to be jQuery as it would start with eq(0) as mentioned above.
Solution
Capybara uses Nokogiri under the hood.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow