Bot should be click 'Argument 1, Argument 2, Argument 3, Argument 4,........, Argument n ' links upto last 'Argument n' present link

Hi Forum Team,

Please help me to resolve this issue,

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?

Thanks & Regards,
Smitesh

Hi @Smitesh_Aher1

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)

@Smitesh_Aher1

Depending on arguments you can use for loop number of times

chees

Thanks for replying…

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.

So, how we can do this?

Hi @Anil_G ,

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.

@Smitesh_Aher1

Depending on Ui it shuld click?

then use for each ui element and indicate the element or link you want to click

if you already know how many then use Enumerable.Range(1,50) for clicking

cheers

Okay @Anil_G , @supriya117 let me check this by using for each ui element activity.

If it works will update you.

Thanks & Regards,
Smitesh

1 Like

Hi @Anil_G , @supriya117 i tried by using for each ui element activity but not working as per expectation.

Hi @Smitesh_Aher1 ,

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.

@Smitesh_Aher1

Can you please tell what is not expected ? or how the ui looks and what you tried?

cheers

When i am using for each ui element activity it throwing the error like "For each ui element activity is restricted currently for web application.

@Smitesh_Aher1

If windows then for each ui element or find children both wont work

we need to go with using index…need to find a similar selector for all and use idx

cheers

Hi @Anil_G

Can you please elaborate for better understanding?

Just a side comment, Find Children would work on Windows applications as well. Only For Each UI Element is limited to web applications.

1 Like

@Smitesh_Aher1

As mentioned by @efelantti please try with find children

if not…first find a selector for the link which looks common then add idx to it and use it

<ctrl name='Link' idx='1' /> for first link idx=‘2’ for second doc

cheers

Hi @Smitesh_Aher1 ,

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:

  1. 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.
  1. 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.
  1. 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.
  1. Construct the Dynamic Link Name:
  • Inside the ‘For Each’ loop, use the Counter variable to dynamically construct the link name, e.g., "Argument " + Counter.
  1. 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.
  1. Click the Link:
  • If the link exists, use a ‘Click’ activity to click on it.
  1. Increment the Counter:
  • After clicking the link (if it exists), increment the Counter variable by 1.
  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.

Thanks @Anil_G i will try this.

1 Like

Thanks @Sanober_Mandokhail will try this and if it working will let you know.

Hi @Sanober_Mandokhail

  1. Get the Total Number of Argument Links:

When i am using get attribute value activity it fetching only ‘Argument 1’ value. How to fetch multiple attribute values?