Copy / Paste Date From One Web Page to Another

I'm totally new to keyboard maestro. Trying it out to cut down on mindless tasks.
My most common use case would be copy / pasting data from an existing web page into another OR into a spreadsheet. Any help would be much appreciated.

I'll attach a couple screenshots. I handle the creation of product pages for an ecom site and much of the data comes from a vendor site. I need to copy / paste SKU's, descriptions, prices, image URL's etc... Hoping to just record click and keyboard strokes i guess...!

Screen Shot 2021-04-29 at 10.29.31 AM|690x314

You need to use the "Execute JavaScript in Google Chrome" action (or similar action) to extract the data first which return a json string that you can use for your application.

You may find it easier to use Chrome to extract data and Safari to fill data if you are extracting data into another web site (since the action work on active tab only)

  • Execute JavaScript in Google Chrome (for input)
  • Execute JavaScript in Safari (for output)

You can try running the example which extract data from a actual ecommerce site.

[EXP] Extract Web Page Data.kmmacros (5.1 KB)

1 Like

@dwgrow, I like @macdevign_mac's idea of outputting the results as JSON string to a KM Variable.

You then can easily read the in a subsequent script to recreate the same JavaScript variables and values using the JSON.parse() function.

However, I don't see a need to use two different browsers.
Once you have the data from the source web page, it is easy to switch to, or open, another tab in the same browser with the target web page. Once open, then the JavaScript in Browser will work fine.

BTW, I always try to use Execute a JavaScript in Front Browser action. This allows the KM Action to work with whatever Browser and whatever window/tab is front most.

So, this is not too hard if you know how to use JavaScript.
The key is in identifying/constructing the CSS criteria for the JavaScript querySelector() function.

@dwgrow,
If this all sounds greek to you, then if you will post the URL of both the source and target web pages, and list the exact fields you want to get and set, then I'll take a look at doing this.

BTW, in the future please just paste, or drag/drop your images directly into the forum edit/compose panel.