Question

How to select a dynamic object in Chrome?

  • 8 June 2022
  • 3 replies
  • 26 views

 

I am using "CAPTURE" to select a link, the position of this link changes frequently, it depends on the data of the client. How can I select this link that changes position? I attach some pics


3 replies

Hi @EDWIN SALINAS​ 

 

Try to capture the two links using Recorder(If AA 360) / Object Cloning (If 11x) and compare the object properties between these two captures.

 

You will find either the PATH/DOMXPath in the object property is incremented for the same link.

 

For Eg: if the paths for the two links are 1|2|2|1|2 and 1|2|2|1|3.

You can see the last number is incremented from 2 to 3. This is the exact place where you got to make this as Dynamic by using a counter. Please find the below logic.

 

#Comment

 

nCounterVariable = 1

Loop Starts

#Incrementing the counter to 1 to match the Object property of the link

Increment nCounterVariable to 1

#This condition is to check whether the link is present or not. If not present breaking the loop. This mean we came to the end of the page.

If - Object property does not exists = using the Dynamic Path as 1|2|2|1|nCounterVariable

Break the Loop

# Performing the Capture action with the dynamic Object property

Do recorder/Object Cloning using the Dynamic Path as 1|2|2|1|nCounterVariable

# Add your Code Here

Loop Ends

 

In this way you can achieve looping through each link in the webpage, no matter how many you have.

 

Hope this helps!

 

Regards

Dheeraj Reddy

hi @Dheeraj Nagireddy​ 

if I got this:

PATH: -55|1|2|1|1|1|2|1|1|1|1|1|-1|-2|1

PATH: -54|1|2|1|1|2|2|1|1|1|1|1|-1|-2|1

 

The code would be like this:

 

PATH: -5nCounterVariable|1|2|1|1|nCounterVariable|2|1|1|1|1|1|-1|-2|1

PATH: -5nCounterVariable|1|2|1|1|nCounterVariable|2|1|1|1|1|1|-1|-2|1

?

@EDWIN SALINAS

Yes it is. You should also be aware of the end of the page link when you want to stop the selection, if you use a loop by following the logic which I have posted earlier.

 

cheers!

 

Regards

Dheeraj Reddy

Reply