Skip to main content
Solved

how can i use While Loop to capture all (e.g.) a tags?

  • May 23, 2024
  • 2 replies
  • 133 views

Forum|alt.badge.img

I am attempting to capture all the <a> tags on a web page, then logging all the hrefs from those a tags. Not sure how to get started, other than using the Loop action.

Best answer by Bot Dev

Try this: https://botstore.automationanywhere.com/bot/a2019-html-parser-package

Use Search with selector activity or Simple search for elements by tag

2 replies

jon.stueveapeople
Automation Anywhere Team
Forum|alt.badge.img+7

you could use Loop While Recorder:Capture Object exists - then use wildcards in the selection for the capture so it can be iterated through.
 

A better way would be to captue the webpage as a file, then use a string operation to find each instance of the “<a href=” string and extract the url using something like a regular expression.

There are many different ways to perform this operation, you might need to go back and redefine the process.


Forum|alt.badge.img+8
  • Navigator | Tier 3
  • Answer
  • May 23, 2024

Try this: https://botstore.automationanywhere.com/bot/a2019-html-parser-package

Use Search with selector activity or Simple search for elements by tag