How to determine which action to use on web page elements

Ok I am working on yet another Bank Statement Download Macro. #bsdm

The link is not a full link so I can’t use Safari Click Link to open it for the Statement. The link also appears to change each month. So how can I get it find a link using a text variable in the middle of the text it’s looking at so it works for any month?

Here’s an example of how the links appear:

Unviewed Documents Mark All Viewed
• 2016 February Statement
• 2016 March Statement
• 2016 April Statement
• 2016 May Statement

Here’s the the link for the February Statement:

<a href="/cowww5/viewers/viewdoc.asp?AppID=55&amp;PrimaryKey=7782037">2016 February Statement</a>

So I am guessing I need some thing that will click on the first item it finds using a text variable such as something like this: “2016%variable%Statement” or even "CurrentYearVariable%AnyMonthName%Statement%

Is this even possible? Before you go asking for the web page remember this is in a secure area so it might be easier if I post the page source for you.

Hey John,

I edited your post to show the html instead of a dead link.

I thought we'd covered this basic methodology before, but perhaps I'm misremembering.

That's a relative link.

Copy it, and put it in TextWrangler or BBEdit or somewhere you can easily refer to it.

Then go-to the actual page, and copy that URL to the same document.

Note the difference.

See what the base-URL for that relative link is.

Then you parse the source of the page for your relative link like this:

Keyboard Maestro “Generic-Test 01” Macro
Generic-Test 01.kmmacros (3.2 KB)

Then you assemble the full link from the base-URL and the relativeURL.

Then you open the full URL in Safari.

-Chris

No problem. Edit away. :slight_smile:
I think it might have been someone else since this is pretty clear to me. This is much like an FQDN. So… if you did mention it to me I would have understood the absolute/relative difference, but I don’t recall seeing the “document.body.parentNode.outerHTML.” string though.