Skip to main content
February 4, 2025
Question

DomXPath

  • February 4, 2025
  • 7 replies
  • 341 views

Can we give a wild card(*) in dynamic DomXPath? Instead of using counter.

Ex: //table/tbody[1]/tr[*]/td[3]/a[1]

7 replies

Aaron.Gleason
Automation Anywhere Team
Automation Anywhere Team
February 4, 2025

No, unfortunately you cannot. If you could, you would be specifying multiple objects, rather than just one as the Recorder: Capture package needs.

Your best bet is to use a counter. It doesn’t take that much extra effort and will allow you to point to a single object as expected.

Chou6Author
February 4, 2025

Thank you Aaron. Can we capture an object with out using DomXPath and using inner html and html title alone?

Chou6Author
February 4, 2025

If using counter, should I get the table into a data table and capture number of rows? And loop through the rows? Based  on what value will the loop end?

Aaron.Gleason
Automation Anywhere Team
Automation Anywhere Team
February 4, 2025

Thank you Aaron. Can we capture an object with out using DomXPath and using inner html and html title alone?

Usually, yes. Like other properties, DOMXPath can be turned on or off. It just takes a bit of experimentation to see what the best solution is.

If using counter, should I get the table into a data table and capture number of rows? And loop through the rows? Based  on what value will the loop end?

Capturing the HTML table into a data table is usually a good idea. You can then loop through the data table. No need for a counter or to find out the number of rows. Each row is stored in a Record variable (don’t use “multiple variables” for an HTML table) and will include the header row, unless you use Data Table: Delete Row (index 0) to remove the header.

Chou6Author
February 4, 2025

I am trying to export a search query to excel depending on the title. So counter is best to go to the row I guess, but my loop is not incrementing as it is supposed to.

Chou6Author
February 4, 2025

Thank you for all your inputs Aaron 

madhu subbegowda
Most Valuable Pathfinder
Most Valuable Pathfinder
February 6, 2025

You may use counter in a loop, this should help you. Using wildcard might not working as expected.

Madhu Kumar T S || https://www.linkedin.com/in/madhukumarts/