Skip to main content

Can wildcards be used in objects that slightly change?

The object is really just a folder in a web portal, the problem is when a new folder is added, the path changes. Any suggestions would be helpful. 

See below comparison of domxpath differences and picture of object

 

Old DOMXPath: 

//divd@id='teamFoldersSlideoutContent']/divd3]/divd1]/divd1]/divd1]/tableb1]/tbodyo1]/tr;4]/td/2]/divd1]/divd1]

NewDOMXPATH:

//divd@id='teamFoldersSlideoutContent']/divd3]/divd1]/divd1]/divd1]/tableb1]/tbodyo1]/tr;5]/td/2]/divd1]/divd1]

 


 

Hey @EricSullivan ,

 

As per the path shared I can see that it is a table, and as you want to capture the last item what you can do is capture the table and get the number of rows and pass that variable in the trt] as because only the tr is changing rest everything is same.

 


Hi @EricSullivan ,

 

You can keep a counter as mentioned below and increment the same while looping through each row of that table.

 

//div/@id='teamFoldersSlideoutContent']/div]3]/div]1]/div]1]/div]1]/tablet1]/tbodyt1]/trn$Counter$]/tdg2]/div]1]/div]1]

 

Keep in mind that the Counter variable has to be converted to string (since it will be a number type)


Hi @EricSullivan ,

 

You can keep a counter as mentioned below and increment the same while looping through each row of that table.

 

//div/@id='teamFoldersSlideoutContent']/div]3]/div]1]/div]1]/div]1]/tablet1]/tbodyt1]/trn$Counter$]/tdg2]/div]1]/div]1]

 

Keep in mind that the Counter variable has to be converted to string (since it will be a number type)

Hey @Padmakumar ,

 

I think he wants to extract/click the last item and as it is a table the get rows and passing it to the xPath will work right?


@EricSullivan ,

Sorry, I misinterpreted. 


In your case, try using any other Object property (innerHTML or HTML Value) which is consistent throughout the environmental changes. I don’t think DOMX Path would be a good option here. 


@EricSullivan Do try using counter(convert number to string) and increment it in loop.


Reply