0

Is there a way to run an Javascript using AppleScript

here is the JS :

javascript:Array.from(document.getElementsByClassName('action-button')).forEach(function(v){v.removeAttribute("disabled");});

I tried this

tell application "Google Chrome"
    tell tab 2 of window 1 to set RemoveBtRestriction to execute javascript "javascript:Array.from(document.getElementsByClassName('action-button')).forEach(function(v){v.removeAttribute("disabled");});"
end tell

but this return the error "Expected end of line but found identifier."

1

Try adding single quotes around the word "disabled". Like this...

tell application "Google Chrome"
    tell tab 2 of window 1 to set RemoveBtRestriction to execute javascript ¬
        "javascript:Array.from(document.getElementsByClassName('action-button'))
.forEach(function(v){v.removeAttribute('disabled');});"
end tell

I don't have a URL to test it on but at least the code compiles now

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .