Selenium webdriver 单击所有复选框并匹配[Ruby Selenium webdriver]

Selenium webdriver 单击所有复选框并匹配[Ruby Selenium webdriver],selenium-webdriver,rspec,capybara,Selenium Webdriver,Rspec,Capybara,当我点击SelectAll复选框时,右角的值显示“selected 4”,我需要编写与selected 4相匹配的案例 我该怎么做?我正在使用ruby selenium driver.find_element(:name, "xbox").click element :selectedcount, :css, 'span[id=systems_removal_count]' 你的问题不是很清楚,但看起来你在使用site_prism,所以我假设你有某种页面对象,我将其命名为@home,在它上面

当我点击SelectAll复选框时,右角的值显示“selected 4”,我需要编写与selected 4相匹配的案例

我该怎么做?我正在使用ruby selenium

driver.find_element(:name, "xbox").click 
element :selectedcount, :css, 'span[id=systems_removal_count]'

你的问题不是很清楚,但看起来你在使用site_prism,所以我假设你有某种页面对象,我将其命名为@home,在它上面定义了
selectedCount
元素。Mathew检查文本,你可以这样做

expect(@home.selectedCount).to have_text('selected 4')

这完全取决于您在该元素中的期望值

expect(@home.selectedCount).to have_text('4')