Take a look at this macro. The core of it does exactly what you are asking for.
You would just need to change the Actions that process each link to do as you wish.
OK, I have enhanced my macro to provide for an optional FILTER of the Link Text. If used, it will return ONLY those links that CONTAIN the filter.
I have tested this ONLY on this page, so you will need to test on the real page you want to get the links from.
If you want to "click" of each of these links, you can ADD this KM Action in the "For Each" Action block:
To setup this macro for your web page, you will need to determine the CLASS of the major HTML Element that either contains, or is used by, each of the Links of interest. You can do this by inspecting the page. Right-click on the first link, and select "Inspect", and you will see:
Extract Web Page Links Using HTML Class, and Process Each Link
MACRO SETUP
Note that all Actions with the magenta color are designed to be changed by you.
In some cases, they MUST be changed to fit your specific requirements.
Move Macro to Macro Group that limits trigger to apps you plan to use it with
(Note: This macro can be used ONLY with Google Chrome, but could be easily changed to use Safari, just by replacing the Chrome Actions with Safari Actions)
Assign a Trigger
Set the below Action "SET Source URL" to the URL of the Web Page that contains the list of links.
Set the below Action "SET HTML Class" to the unique Class of the HTML Element that contains each, or all, of the list of links.
Set the below Action "SET Filter for Link Text" to text that the link must contain. Clear the text (no characters) if you do NOT want a Filter.
ADD Actions at the bottom of the Macro to process each link as you desire.
If your web page has a lot of links, it is best to first TEST on a similar page with just a few links)
HOW TO USE:
Open Google Chrome Browser (any page)
Trigger this Macro
WHAT IT DOES:
Gets a HTML Collection of all Elements that have the specified Class Name
Gets a HTML Collection of all Links (Anchor Tags) within that collection
Builds a TAB delimited list (array) of Link Text & URL from that collection
Returns a TAB delimited String, with each link on a separate line
FOR EACH link/line in that String:
Using RegEx, parses it into Title and URL
Process that Link
TAGS: @Links@Web@JavaScript@HTML
USER SETTINGS:
Any Action in magenta color is designed to be changed by end-user
This macro uses Google Chrome, but can be easily changed
ACTION COLOR CODES
To facilitate the reading, customizing, and maintenance of this macro,
key Actions are colored as follows:
GREEN -- Key Comments designed to highlight main sections of macro
MAGENTA -- Actions designed to be customized by user
YELLOW -- Primary Actions (usually the main purpose of the macro)
ORANGE -- Actions that permanently destroy Varibles or Clipboards
REQUIRES:
(1) Keyboard Maestro Ver 7.3+
(2) Yosemite (10.10.5)+