ATS: Count drop down options

0
Is there a way to count drop down options in ATS?
asked
2 answers
1

Hey Siddhahrtha Thapa,

Why do you want to count the items in a dropdown?

You could do it with JQuery code. What you could do is using the action 'Execute Javascript String' or 'Execute JavaScript Integer'. Inside that you can add as a script something like: 

var size = mtf.$('.mx-name-referenceSelector1 option').size();
return(size);

This is JQuery code, for more information on JQuery you could take a look at: https://www.w3schools.com/jquery/jquery_ref_selectors.asp 

Due to the .size() method you will get a number back, containing the size of your dropdown elements. To compare whether that size is as expected you could use the assert equal to action after that. For more information on how to use the debugger and create your JQuery code for ATS, you can take a look at the following documentation: https://docs.mendix.com/ats/howtos/ht-version-2/create-custom-actions-2

I hope this helps!

Kind regards,

Myrthe

answered
0

try this interactive...jQuery tutorial

answered