I've got a bit stuck with this so hopefully someone can point me in the right direction.
Basically I'm trying to execute a javascript in Chrome for a specific website.
The javascript works in Safari - from the Safari Dev Console, from the execute JS command in KM and also from Applescript Script Editor.
The same javascript works in Chrome from the Dev Console, but does NOT work from KM or from Script Editor.
Below is the Applescript code for bith Safari and Chrome. In Script Editor when targetting Chrome it just says "missing value", so unsurprisingly in KM it also doesn't do anything. The JS is meant to adda an item to the basket
Both require the following webpage to be open and the active tab:
tell application "Safari"
activate
set theJS to "Ecwid.Cart.addProduct({id: 616681326, quantity: 1, options: {'Print Size':'A4 297x210mm'},});"
tell front document
do JavaScript theJS
end tell
end tell
tell application "Google Chrome"
activate
set theJS to "Ecwid.Cart.addProduct({id: 616681326, quantity: 1, options: {'Print Size':'A4 297x210mm'},});"
execute front window's active tab javascript theJS
end tell
Other JS commands are working in Chrome from from KM or Script Editor so it doesn't appear to be a general issue with executing standard JS commands from KM or Script Editor
The actual javascript being executed is a site specific API Javascript function - not sure if that makes any difference when dealing with Chrome?
If anyone has any insight it would be so appreciated.