kreal
August 31, 2017, 10:26am
#1
Hello!
It's not actually a KM question but i can't get it and hope that some one will help me with this.
I am willing to use applescript to with KM macro to press a button (button id="signInSubmit") on a webpage (mostly in Firefox), the applescript code is:
clickID(signInSubmit)
tell application "Firefox"
do JavaScript "document.getElementById('" & signInSubmit & "').click();" in document 1
end tell
end clickID
Tell me please what is wrong with the code, because it's not working.
Thanks a lot in advance.
gglick
August 31, 2017, 10:41am
#2
Firefox doesn’t support AppleScript, so that would explain why this script isn’t working.
kreal
August 31, 2017, 10:49am
#3
Oh, okay
Thank you for the fast answer.
But injecting a bookmarklet via the URL bar might well work. So long as you know the button’s id.
kreal
August 31, 2017, 11:03am
#5
Could you provide an example of it?
Sorry I don’t have time to do a worked example but your fragment of javascript is about right.
You need to URL encode it and prefix it with javascript: and inject it into the URL bar.
Cmd+L gets you the URL bar. Then paste by typing and then send the Enter key.