This is a set of three macros I made today.
The three macros together let you save the data you have entered into a form, and then fill it in on command. So if you have a form you need to fill in multiple times with variations, you can save most of the data, and just make the changes for each one. My common usage for this is entering multiple children into a camp form.
The three macros are run in sequence:
- Load up the form in Safari or Chrome, and leave it blank.
- Run the Snapshot Start Form. The macro saves the state of the empty form.
- Fill in the form.
- Run the Snapshot Read Form. This saves the difference, ie all the data you have entered, into a variable * Captured Web Field Data*. It displays the fields in a text window, but you can turn that off if you want.
- Submit the form, and then reload the page.
- Run the * Snapshot Set Form*. This fills the form with the saved data.
- Make any changes, submit the form and repeat.
It needs work to extend it to be really useful, but it's a solid start.
- it only saves a single form. Ideally the forms would be saved for each web page, or each domain or something.
- it doesn't currently handle popup menus.
So if anyone wants to take this and run with it, I'd be very happy to see a @DanThomas job done to it
BTW, for anyone who wanted to know about uses of dictionaries, this macro makes use of them to speed up the processing significantly.
Browser Forms Macros.kmmacros (21 KB)
At some of my former places of employment, doing a “Dan Thomas job” wasn’t necessarily a positive thing.
Glad to know that’s not the case here. Thanks for that, it made my day.
Thanks for the macros, Peter. Looks very interesting.
I was reading your macros, trying to understand them, and ran across this at the bottom of
03)Snapshot Set Form macro:
That action does nothing, just delete it.
Wow, you've all really given me some ideas here!
I run a PC repair shop and fill out forms for new tickets multiple times a day. I'm tinkering with this and read about how to get the form ID's to do this manually. I am lost with a few things though, maybe one of you could help?
Several parts of my forms have dropdown/list menus. I can't figure out how to pick from my lists. I also can't find the ID for one button to click to send the filled out form. There are two buttons on the form to submit and no matter which ID I've selected, it uses the first option. If anyone has the time and expertise to make any suggestions, I would really appreciate it!
New Ticket - New Customer 2.kmmacros (18.0 KB)
New Ticket - New Customer.kmmacros (8.7 KB)
HTML.zip (1.6 MB)
<div class="btn-toolbar right">
<input type="submit" name="commit" value="Create Customer" class="btn btn-sm btn-success">
<input type="submit" name="commit" value="Create Customer And Ticket" class="btn btn-sm btn-success">
In Safari (you might need to turn on the Show Develop menu in menu bar in the Advanced preferences), you can control click on an element on a web page and select Inspect Element.
Control click on the "<input" text, and select Copy XPath.
That will give you something like this:
Then create a Click Front Browser Link action and paste that in:
That will click the Create customer button.
Repeat for the second button.
I have been able to get the XPaths from Safari to work, except for when a website uses frames. Is there a way to work with those? The XPath that I copy and use just gives the error that it couldn't find it.
Welcome to the forum!
Don't forget to search.
Selecting XPath in iFrame - #2 by peternlewis
Thank you. I did see that post but I didn't see any replies from anyone that would indicate whether it solved their problem or not. I can get what's shown to work, but to what end? I end up with a variable called HTML with source of the frame inside of it. I have no more information on where to go next.
Thank you for your reply!
The website it intranet only, so I can't share it.
The XPath leading up to the iframe is as follows:
If I get the XPath on the iframe, I only get:
The source for the button I want clicked is:
The XPath for the <cc-button...> line is:
Or do I need to click the which has the XPath:
Does that help?