Browser-Based Web-App Not Playing Well With KM

Hi All!

I've been using Keyboard Maestro for over a year now to automate repetitive tasks in a web-based app, specifically an Oracle product called Agile PLM. I'll write a criteria-based query in the app that returns a list of items that match, then I'll have a KM script that selects the first item from the list and then does things like: move the cursor to a specific coordinate, click the mouse button, wait for a button to appear, move the cursor again, click the button, move to another coordinate, paste in text, click on a hyperlink which shows the remainder of the list, then repeat (loop).

For the most part it works great but I have a couple of scripts that frequently result in weird things happening in Safari (or Firefox, or Brave) that I have never seen when interfacing with the app manually. Some examples are the browser window displaying a white screen when clicking a link or button, or the app throwing up an error that required fields have not been populated when trying to save a form when clearly the fields are populated. I thought maybe the errors are because KM is going so fast the app’s server can’t keep up so I introduced pause statements in between most steps but it didn’t really help. The problems seems totally intermittent as sometimes it can run for 15 minutes or more and sometimes it will only run a few seconds before the app throws up some bogus error or the browser flakes out.

I’ve tried clearing the browser cache, deleting cookies, quitting and restarting the browser and restarting the computer but nothing really seems to help. I've also increased the length of my pause statements so that it operates at a speed more like that of a person doing the same thing but I still get errors using KM that I never get when I'm performing the same steps manually.

Thought I would check here to see if anyone has any ideas. Since the web app is a third party product I don't know that much about what it's code is doing "behind the curtain", but I also don't know how the app would know if KM is moving the cursor and clicking buttons vs. a person doing the same actions.

Keyboard Maestro: 9.2
macOS: 10.15.7
Firefox: 84.0.1
Safari: 14.0.2
(The problems also happened with earlier versions of all of the above)

Hey Jim,

Welcome to the forum!   :smile:

If you can you should post an image of what you're doing to give us more perspective on what's happening.

You should also tell us what version of macOS you're using.

If you haven't read this it's worth a couple of minutes of your time.

Tip: How Do I Get The Best Answer in the Shortest Time?


This problem of yours is a very tough nut, and no one will be able to answer with authority without being able to test and repeat the problem. Even then there are mysteries.

Nevertheless I'll conjecture a bit.

This is a complete “It does what?” situation. That's totally bizarre.

Sometimes applications don't register input has taken place in a field, when the input is “simulated” as opposed to actual user input.

Sometimes this can be worked around by telling the object to accept the input.

Sometimes timing is the problem – sometimes it only seems to be the problem.

Since you're working in a scriptable browser with Safari, Chrome, or Brave you should try filling the fields via JavaScript instead of by clicking.

I'm using the base Google search page for the following examples.

This one selects the contents of the defined field:

Front Browser Control.kmactions (475 B)

These two focus on and set the contents of the defined field:

Keyboard Maestro Actions.kmactions (764 B)

Here's an example of the sort of thing I'd try to achieve in your task.

Fill Google Query Field and Submit Search v1.00.kmmacros (7.2 KB)

-Chris

Hi Chris,

Thanks for your response! Yeah, I know, this is a totally bizarre problem and I didn't really think that I'd hear from anyone experiencing the same problem but I was hoping maybe someone with better a better web engineering background than I might have a clue what could be going on.

Unfortunately because of my company's strict secrecy policies I'm not allowed to post any screenshots of any internal applications anywhere. My original post did list the version of macOS though (10.15.7 but it's also happened on prior versions, e.g. 10.14.x). Sorry, I know that probably doesn't help much.

I am intrigued by the javascript idea though. I don't know javascript but I will explore that a bit to see if I can make any headway. Thank you for the suggestion.

Best Regards,
Jim

1 Like

Hey @ccstone

Just wanted to give you an update. Although I've never used javascript before I was able to hack through it to update my script to use a few js commands. Although I still get an occasional glitch I'd say that overall there has been a vast improvement. Not only that but I've been able to remove some of the Pause statements so the scripts run about 50% faster! I really appreciate your thoughts and the example scripts which were very helpful. I learned something new in the process as I didn't even know that there was this option to use javascripts to update a web form before this.

Thanks again!
Jim

2 Likes

Hey Jim,

Subscribe to the mailing list in your forum user-preferences.

Filter the Keyboard Maestro Forum emails into their own mailbox.

Scan through them at your leisure and investigate anything that interests you.

In a year you'll learn a lot and become a power-user.  :sunglasses:

-Chris