I've been asked by a colleague to help with his problem but I too, am becoming stuck on it.
He wants to find a clickable element by the text on it from a list he's got.
The list contains:
list = [ 'cat : B',
'cat : B1',
'cat : BE'
]
When he iterates over the list, the first iteration clicks on cat : B
as expected. The next iteration also clicks on cat : B
instead of B1
.
the code used is:
list.each do |cat_item|
find('li.category', text: cat_item, :match => :prefer_exact).click
It's looks as though Capybara is only matching as far as the first B and thinking it's found the element, instead of matching to B1 or BE.
Is there a way around this? I've tried several ways