Skip to main content

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

Ex: //table/tbody[1]/tr

  • /td[3]/a[1]

  • 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.


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


    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?


    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.


    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.


    Thank you for all your inputs Aaron 


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


    Reply