Variable in web element

variables
xpath
implemented
web-element
#1

AM I correct to understand we cannot use variable in Web Element ?
I get error in on this web element : xpath value is build dynamycally and at the moment of the error it value was

//*[@id=“result_1”]/div/div/div/div[2]/div[1]/div[1]/a/h2

Error :

WebElement xpath harcoded?
#2

@Pierre_Bernier3,

Currently, variables in the XPath field are not supported.

Please vote for this feature to raise its priority.

#3

Thanks for your answer

So how do you suggest to loop through a list of xpath like :
//[@id=“result_1”]/div/
//
[@id=“result_2”]/div/
//[@id=“result_3”]/div/
//
[@id=“result_4”]/div/
… and so on ?

2 Likes
Is there any way to capture all similar elements based on XPath
#4

Anyone got an answer to this?

#5

I’m struggling with this one as well. I would be very happy to see variables used as an input to elements like mouse clicks using an XPath.

#6

@NRudy_Capgemini2,

please vote for this topic to see this feature in RPA Recorder as soon as possible.

#7

Please add this feature to use variables in xpath field.

#8

The XPath way of doing this would be to get them all at once using “Web Element” and then save the resulting elements to a list:

//*[contains(@id, "result")]/div/

Afterwards you can loop through the resulting list and do the appropriate actions on each item.

1 Like