Wiki: Need Input on New Article about "How To Click on Web Page Buttons and LInks"

###Need Input on New Article about “How To Click on Web Page Buttons and LInks”

This is a FAQ, and there are dozens, if not more, specific responses.
I would like to develop a Wiki article that specifically addresses how to do this, but provide the instructions that users can use with any web page.

As some of you know, often a “button” or “link” is not really a standard HTML element, but a JavaScript element that will produce the desired action of the web page designer. So this makes it a challenge to automate externally.

There are a few KM Actions that might be used for this, but it is not always clear to the user (particularly new users) how to use them.

I have found that most often I need to inspect the HTML of the web page using the Chrome Inspect tool. But once there, I may need to do many different things. It would be great to have some JavaScript tools to aid in this. Do you have any?

So, please, if you have some good solutions, that are either generalized or can be easily made so, please post them (or a link to them) in a reply to this topic.

Thanks.

###Hey guys, we really need your help here.
We continue to get questions about clicking on links/buttons.
If you have, or know of, some good solutions and/or tutorial material, please post below.

Thanks.

I can’t really help with this I’m afraid because frankly I don’t really know much about it.

I bash some combination of click and image and click link depending on what works, but there are better ways.

If I implement XPATH in Keyboard Maestro more natively, that might help, but that is a big if at this point.

Hi JMTX — I have done this a lot … essentially processing various web pages using KM as my agent. Can you point me to any specific questions, issues, or a draft of the FAQ? I’m glad to contribute — I hope usefully — but I do best with some constraints. I don’t use Java (I don’t use anything but KM and some very basic AppleScript that was given to me here on the KM forums).

The following observations & recommendations might be obvious, but come from experience:
. Web pages are all different, frequently change, and may not be well-built. Little of any site-specific KMacros can be relied on to work on different sites, or on the same site for more than a few months.
. My #1 rule: even tested macros need to be baby-sat. Never assume that a macro that worked on site.com an hour ago to work flawlessly now.
. The structure of the macro can usually be replicated for similar sites. You will likely need to use some different actions, and surely will need to use different data within the Actions.
. The least efficient but probably most secure approach is to parse the page source. This is cumbersome for the savvy, and likely impossible unless you are versed in RegEx.
. Turn on “ ▹ System Preferences ▹ Keyboard ▹ Shorcuts ▹ Full Keyboard Access ▹ All controls”.
. Use Pauses. A lot. If something doesn’t work, add a Pause Action, or increase the pause in an existing action. A Pause of even 0.05s can make a significant different (over no pause).
. Have a fast connection (2 MB/s or faster). You can overcome this limitation, but it requires extra work.
. Use “Found Images”. Learn to use the fuzziness to advantage.
. Limit macro execution to one screen size and resolution.
. In general, find a way to set the page to a default (size, orientation, content, cursor position, insertion point location), then use Actions (keystrokes or mouse movements) based on that default.
. Process sets of sub-pages as tabs in the Web browser. Process each page in the set, then close all pages but the page containing links to the sub-pages. Limit sets to about 20.
. If you are downloading files, use a dedicated download manager (I used Many Trick’s Leech, which — like everything they make — was fantastic, but isn’t — last I checked — still current. I now use iGetter, which reminds me of old Windows programs: uglier than a dog’s breakfast, but gives a good day’s work.)

HTH. —Kirby.

1 Like

Kirby, many thanks for your offer to help. I'm sure your experience will be very valuable.

I don't even have an outline of the FAQ, much less a draft. So, I'm looking for any input/feedback from anyone, like you, that has experience in designing solutions to click on various links, buttons, images on a web page.

If you want to get an idea of the questions people are asking, do two forum searches:

  1. "click link"
  • "click button"
    • this may yield some false positives about clicking app buttons

So, thinking out loud, I'd like to develop a wiki article that would:

  • Guide users in how to inspect an web page and then design a solution for clicking on whatever they want.
    • I think there are probably existing web articles, books, etc that already address this.
    • But just providing a curated list for users would be a big help
    • Of course, anyone that want to write their own is more than welcome.
  • Provide as many good examples as we can.

As I see it (and everyone feel free to correct me), there are about three basic approaches for this:

  1. Using the native KM actions, like Click Google Browser Link action (KM Wiki)
  • Just having a good list, and which Actions to try first would be a big help.
  • Using Execute a JavaScript in Browser action (KM Wiki)
    • Two main sub-sections here: Using DOM functions; Using xPath
  • Parse the source using tools like RegEx, XML, etc

Again, this is just off the top of my head, so everyone feel free to jump in with corrections/suggestions.

I hope this helps you, and everyone, have a better idea of what is needed.