Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What library does Capybara use as CSS selector?

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.

like image 852
Zardoz Avatar asked May 23 '26 12:05

Zardoz


1 Answers

Capybara uses Nokogiri under the hood.

like image 59
Joshua Partogi Avatar answered May 26 '26 13:05

Joshua Partogi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!