Form Automation Question – Mobiscroll Test Macro

I previously posted regarding accessing spreadsheet values through a macro. However in making further efforts I ran into a more basic difficulty in trying to automate a couple of items on a web form in Safari.

Previously I successfully followed a short tutorial created by envatotutus ( For further testing I turned to which has posted many examples of GUI widgets.

Here is a link to their example Desktop Form page:

With KM I tried to create a simple macro using Safari which 1) selects the state of California and 2) presses the Sign-in button. Unfortunately I haven't been able to get this to work. Can someone point me to one or several examples or tutorials which explain how to pick the salient elements from a form and how to set their values so that KM can operate on the form? If I can figure out how to get going (first steps are usually the hardest, as you know) I'll be happy to spend a few hours going through some of the major widgets available from Mobiscroll and sharing the set and focus entries I used to get the automation to work. I'm sure I'm making some basic mistakes; your patience is much appreciated.

Macro follows…

mobiscroll test Macro (v9.2)

mobiscroll test.kmmacros (2.0 KB)

You can get the XPath for the fields using the Safari console. Control click on the element and select Inspect Element, and then control click on the XML and select Copy as XPath.

The result would be:


But the mobiscroll ID appears likely to be randomly generated so it probably is not stable.

You can use "Sign in" and Keyboard Maestro will find it for you, but in this case it seems to find an Sign in button to sign in to the web site, so that is not entirely helpful.

All of this depends heavily on the web page and how it is generated.

1 Like

Thank you for taking the time to answer this q.

On reflection and after looking at the promising-sounding description on the KM home page, I'd highly recommend adding a prominent disclaimer or asterisk which indicates that many (%-age?) of Web site forms cannot be reliably automated with KM owing to a variety of variables such as the above-described "randomly generated IDs". I, for one, would not have purchased a license had I been made aware that many web forms (%-age?) cannot be effectively controlled (automated) by KM. Any full automation provided by an app such as KM should include highly reliable and reproducible management/control of commonly encountered Web form widgets such dropdown lists, buttons, etc. and should work on all major browsers IMO. Simple but comprehensive easily found tutorial examples should be provided so users can verify that they can make KM work for their Web form needs.

At the time this KM feature was introduced, there were very few web forms that used dynamically generated IDs and classes. Since then, for some reason, more and more web pages are using this method.

But I do agree with your suggestion that the KM Wiki Article Browser Form Actions actions should be revised to add a notice at the top that those Actions may not work with some web pages.

KM clearly states that its Actions, Tokens, and Functions that are web specific work only with Safari and Google Chrome (and Chrome-based browsers for FrontBrowser items).

KM is highly reliable, but everyone needs to recognize that due to the complex nature of web pages, there may be some pages where KM will not work as designed.

And even with those web pages, you may be able use use KM tools like Execute a JavaScript in Browser actions to get and set these dynamic web form fields. I have often used querySelector to work on these pages.

Sorry that you have encountered problems with some web pages.
However, the scope of KM is much, much broader than just automation of web pages.

Please take a look at Best Macro List -- KM Forum for some really good examples of how KM can automate all aspects of your Mac workflows.