简体   繁体   English

在控制Google Chrome浏览器时,Applescript JavaScript“行尾但找到了标识符”错误

[英]Applescript JavaScript “End of Line but found identifier” Error when controlling Google Chrome

The following is a part of my AppleScript script that should click an element in the current tab of Google Chrome with name 'connect'. 以下是我的AppleScript脚本的一部分,该脚本应单击Google Chrome当前选项卡中名称为“ 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? 我将如何工作?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Photoshop Applescript调用JavaScript导致错误“预期的行尾等,但找到了标识符” - Photoshop Applescript calling JavaScript causing error “Expected end of line, etc. but found identifier” 尝试填写网络表单的applescript预期出现行尾错误 - Expected end of line error on applescript trying to fill a webform 谷歌浏览器的JavaScript错误? - google chrome error with JavaScript? Javascript使用谷歌浏览器逐行调试 - Javascript Debugging line by line using Google Chrome 谷歌浏览器JavaScript调试代码(逐行) - Google Chrome JavaScript debugging line by line Applescript在Google Chrome中提取文本 - Applescript to extract text in Google Chrome 预期的行尾等,但发现未知令牌。-AppleScript编辑器 - Expected end of line, etc. but found unknown token.- AppleScript Editor Chrome开发人员工具-javascript代码段测试:最后一行出现“未捕获的语法意外的输入结束”错误 - Chrome Dev tools - javascript snippet test : “Uncaught Syntax Unexpected End-of-input” error on last line 当使用JavaScript将光标设置为节点的开头时,Google Chrome会将光标移动到上一个节点的末尾 - Google Chrome moves cursor to end of the previous node when setting it to the start of a node with JavaScript 谷歌浏览器:JavaScript错误消息 - Google Chrome: JavaScript Error Message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM