Find and replace in browser fields


For my accounting business, I often work in Quickbooks online, and will often find myself having to find and replace entries in several fields on the same page. For example, a journal entry might have up to a dozen lines, and each line has a memo field where I enter a date range for, say, a pay period. Easiest way to do this is to duplicate the last journal entry, and then fill in new dates. I have to do this manually since neither Quickbooks nor any of my browsers have a find and replace feature for fields.

So, is there a way with Keyboard Maestro to have it search on a web form, find a term, and replace that term, then (hopefully) keep searching until replaced everywhere? Even just doing a single search would save time.

Bonus points... I have tried to set up macros to fill out Quickbooks Online forms quickly, but usually this has to be done by telling quickbooks to tab through a bunch of fields. So, I am wondering if there is a way to identify a field in a browser form, and then tell quickbooks "go to this field and past this text."

Any ideas would be greatly appreciated, many thanks in advance!


This requires using Javascript and CSS to set the form value, with help of Chrome DevTools to identity the CSS selector to be used.

This will then be used in the following action


Hmmm, well I tried running all that through Google Translate, but there is no option for translating Javascript to English. I just got back this cryptic answer from Google: "Είναι όλα ελληνικά για μένα." :slightly_smiling_face:

So, maybe not something I can tackle with just the ordinary KM functions... if I start playing around with javascript my Mac might burst into flames.

But many thanks!


Using JavaScript would be the best (ie least likely to get it wrong!) way. And it's not that difficult -- the action posted above is translated to "find the thing on the page called 'name' and set its value to 'my name', then find the thing called 'cost' and set it to '32'".

Problem is, you have to do some digging to find out the ids of the "things" on the page (unless someone who also uses that website has already done it). In the top pic you can see that the "Department" field is selected on the left, and the corresponding highlighted section on the right has the id "field3", so to fill in your Department you'd target "#field3".

That's already stretching my knowledge of JavaScript, so if you've made it this far without fainting -- give it a go! You'll be surprised at how easy the easy stuff is...

If you don't want to go that route you'll have to fall back to replicating what you'd do manually -- use KM to select the first field, copy the text, search and replace on the clipboard, paste the text, tab to the next field. Repeat for however many fields you want to check/change. That isn't possible with some form elements though -- "popup" option list values can't be copied, IIRC (though that may be a browser thing) -- so JavaScript really is your best bet.