After logging to application there are different links present like below, Argument 1 Argument 2 Argument 3 Variable 1 Argument 4 … Argument n
We don’t know how many Argument variable links are present like(Argument1,Argument2,Argument3,Argument4…Argument n). but, the Argument value name is fixed only changing the integer value after Argument.
So, i want the bot should click only “Argument” type of link and bot should click be on Argument link upto last “Argument n” link.
**For eg:-**if last link is Argument 50. then bot should stop after clicking on Argument 50.
Please let me know how we can do this by using for loop or any other activities?
Try with “For Each UiElement” activity and let me know if it’s working or not.
And inside for each use click activity (pass the input element as currentelement)
Okay i will try this. but bot should start clicking action from “Argument 1” link upto last Argument link and then bot should stop after last matching link.
Currently i am using for each loop for this But i am passing value inside the loop like {1,2,3,4,5}.
Due to this condition bot is performing clicking operation upto link 5. My requirement is bot should click after 5 if Argument 6, Argument 7, Argument 8, Argument n… link are present.
We could maybe try using Find Children activity first and then based on attribute values that depict the Link Name as Argument we can filter out the Elements that are required only and then perform the For Each UiElement for those filtered Elements.
Let us know if you were able to try the above mentioned method.
To achieve this, you can use a combination of activities, including a ‘For Each’ loop, to iterate through the Argument links until you reach the last one. You can do this by dynamically constructing the link names based on the changing integer values and checking if the link exists before clicking it. Here’s a step-by-step guide:
Get the Total Number of Argument Links:
Use activities like ‘Find Children’ or ‘Get Attribute’ to retrieve the number of Argument links available on the page. You need to find a reliable selector that can capture all these links.
Initialize a Counter Variable:
Create an integer variable (e.g., Counter) and set it to 1. This variable will be used to construct the dynamic link names.
Set Up a ‘For Each’ Loop:
Use a ‘For Each’ loop to iterate from 1 to the total number of Argument links obtained in step 1. Set the loop variable to Counter.
Construct the Dynamic Link Name:
Inside the ‘For Each’ loop, use the Counter variable to dynamically construct the link name, e.g., "Argument " + Counter.
Check if the Link Exists:
Use an ‘Element Exists’ activity to check if the dynamically constructed link exists on the page. The selector should be based on the constructed link name.
Click the Link:
If the link exists, use a ‘Click’ activity to click on it.
Increment the Counter:
After clicking the link (if it exists), increment the Counter variable by 1.
Exit the Loop:
Add a condition to exit the ‘For Each’ loop when the Counter reaches the total number of Argument links obtained in step 1.