0

I am testing an android form (xamarin).
My script looks for a radioButton with a label ="Registered" It finds and performs action on this However there is another instance of a radioButton labelled "Registered" which is several lines below the 1st instance. The cucumber script is always finding the first one only, therefore the script fails.

I need to perform actions on both buttons not just the first instance.

When I do a query("RadioButton") it returns just the one radio button, as on the form the C# code is simply instantiating another instance of the one radioButton. We do not wish to change the code if need be, so I was wondering is there anyway in Cucumber/Calabash to ignore the 1st instance and perform and action on the second instance? Thank you.

Graeme Phillips
  • 131
  • 1
  • 1
  • 10

1 Answers1

0

If the element you want is inside another element, you can use the query syntax to chain together locators. e.g.

query(ListView index: 1 * RadioButton)

Using this you could find the one that you want.

That said, query("RadioButton") should return two elements if there are two currently on the screen. The way the query method works shouldn't care if it's the same element in the c# code. If the element isn't on the screen then query won't return it, so you may need to scroll down/across etc.

alannichols
  • 1,496
  • 1
  • 10
  • 20
  • hi Alan, thanks heaps for the answer... Ive ran the query("RadioButton", :contentDescription) this has returned an array 0 to 5 of the contentDescription elements and their stringName. Now all I need to do is write the feature and custom step def.. which I posted in a new question or 'world of pain' as I am a bit of a noob, only been at this a few weeks! – Graeme Phillips Apr 24 '15 at 14:40