Home > Net >  Capybara expect the page to have 2 different contents in the table column
Capybara expect the page to have 2 different contents in the table column

Time:04-14

I just need to validate two different items in one column. For example if the column of the table writes Yes and No and I want to confirm if these items that are in the column correspond to yes and no..

This method I validate only one item and if I want to validate two items?.

expect(page).to have_css("td:nth-child(5)", exact_text:"YES") #What if I want to validate YES and NO?

CodePudding user response:

You can use regex to check if tr text contain either YES or NO.

expect(page).to have_css("td:nth-child(5)", :text => /^(YES|NO)$/) # What if I want to validate YES and NO?
  • Related