3

The following is a part of my AppleScript script that should click an element in the current tab of Google Chrome with name 'connect'.

tell app "Google Chrome"
do JavaScript "document.getElementsByName('connect').click();" in current tab of first window
end

When is runs, it returns the following syntax error:

Expected end of line but found identifier.

How would I get this to work?

3
  • Have you seen this answer? stackoverflow.com/questions/6561452/… There may be some similarity in the target syntax? Commented Mar 26, 2015 at 19:44
  • 1
    Yeah, tried that one. I wouldn't have posted the question if I had tried other answers and they worked. Commented Mar 26, 2015 at 19:46
  • 1
    Well.. Alright. Thanks.. I guess. Commented Mar 26, 2015 at 20:32

1 Answer 1

3

Never mind. I figured it out.

Here's the code:

tell application "Google Chrome"
    execute front window's active tab javascript "document.getElementsByName('connect')[0].click()"
end tell
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.