Develop function or for each activity

Hello,

I am trying to develop a function or reusable code for the following process:

There are three arrays:

  1. Array of selectors which will be used by get attribute method to get “src” element
  2. Array of “src” element I hope to find and compare with src attribute I got using get attribute activity
  3. If the “src” element is same then set something to True or false

Array of selectors: {Selector 1, Selector 2, Selector 3}
Array of Src attributes : {Src1, Src2, Src3}
Array of Parameters to Set: {Parameter1, Parameter2, Parameter3}

So for example

if:
selector1.getattribute=Src1
Parameter1=True
else:
Paremeter2=False

Thanks in advance for your reply.

Thanks,
Rishi

Hi @RISHI4897

You could try a simple For Each loop activity that will go over all elements in one array. Then, you will need one IF activity with a certain statement that will compare the current element with your desired list. If the element is on that list (=in the second array), you will set a variable to True, otherwise to False. The value you set could be a dictionary, which would allow you to hold both the parameter value and it’s boolean value together.

For both things - the If statement and the dictionary, you can check the Forum, it has plenty of examples of this kind :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.