문제

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.

도움이 되었습니까?

해결책

Capybara uses Nokogiri under the hood.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top