简体   繁体   中英

How to check Sensitivity of Mezzo Unit Tamper field and Mid value? Capybara rspec

Whether there is a list 'li' and all have the same classes. How to check Sensitivity of Mezzo Unit Tamper field and Mid value? enter image description here

Pretty terrible markup to work with here but it's possible to write something like this, and then refactor into some helper methods elsewhere:

dropdown_container = find('label', text: 'Sensitivity of Mezzo Unit Tamper').find(:xpath, '..')
dropdown_container.should have_css('[aria-labelledby="select-label"]', text: 'Mid')

You could break it out into a helper somewhere like this:

def assert_dropdown_value(dropdown_label, val)
  dropdown_container = find('label', text: dropdown_label).find(:xpath, '..')
  dropdown_container.should have_css('[aria-labelledby="select-label"]', text: val)
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM