You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error message: 'expected to find xpath "//div[@Class='box']" 9 times, found 6 matches: "box_2001 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3", "box_2002 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3 attrkulcs4: attrvalue 4", "box_2003", "box_1001", "box_1002 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3", "box_1003 attrkulcs1: attrvalue 1". Also found "", "", "", which matched the selector but not all filters. (Capybara::ExpectationNotMet)'
Note that the found 6 matches is not 6 for every test run. it a number between 4 and 9. I don't really understand what can be the 'matched the selector but not all filters' statement. As I know I'm not using any filters.
I've tried the following selectors, but all of them gives the same error message:
have_xpath("//div[@Class='box']", :count => 9)
have_selector(:css, '.box', :count => 9)
have_css('.box', :count => 9)
I've tried it with capybara 2.2.1 and 2.3.0 also. I'm using Selenium webdriver 2.42.0
Running $x("//div[@Class='box']").length from browser console works perfectly.
The text was updated successfully, but these errors were encountered:
You are actually using filters count and visible (defaults to true) without the relevant css it's impossible to say for sure, however the three empty sets of quotes would tend to indicate that 3 of the .box elements weren't actually visible on the page
Thanks for your help, this was the problem indeed! With a :visible => false flag it works perfectly.
This existance of this visible parameter was not clear for me and I couldn't found anything related to this on the web.
Thanks anyway!
@davidkovaccs just FYI - but visible defaults to true since in most cases when doing user interaction tests one wants tto make sure the content is actually visible to the user
lockbot
locked and limited conversation to collaborators
Aug 17, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have the following html saved with the save_and_open_page command right before the capybara selectors are run (I've also checked page.body, it's the same): https://gist.github.com/davidkovaccs/8991af5bed1805277f52
I get the following error message: 'expected to find xpath "//div[@Class='box']" 9 times, found 6 matches: "box_2001 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3", "box_2002 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3 attrkulcs4: attrvalue 4", "box_2003", "box_1001", "box_1002 attrkulcs1: attrvalue 1 attrkulcs2: attrvalue 2 attrkulcs3: attrvalue 3", "box_1003 attrkulcs1: attrvalue 1". Also found "", "", "", which matched the selector but not all filters. (Capybara::ExpectationNotMet)'
Note that the found 6 matches is not 6 for every test run. it a number between 4 and 9. I don't really understand what can be the 'matched the selector but not all filters' statement. As I know I'm not using any filters.
I've tried the following selectors, but all of them gives the same error message:
have_xpath("//div[@Class='box']", :count => 9)
have_selector(:css, '.box', :count => 9)
have_css('.box', :count => 9)
I've tried it with capybara 2.2.1 and 2.3.0 also. I'm using Selenium webdriver 2.42.0
Running $x("//div[@Class='box']").length from browser console works perfectly.
The text was updated successfully, but these errors were encountered: