在apple脚本函数中使用Javascript时出错

在apple脚本函数中使用Javascript时出错,javascript,applescript,Javascript,Applescript,我得到一个语法错误“预期”,“但找到了标识符”,我不太清楚为什么 tell application "Google Chrome" tell document 1 to set failedTest to (do JavaScript "document.getElementsByClassName('specDetail failed')[0].getElementsByTagName('a')[0].title;") end tell 在这里,它的突出显示JavaScriptChr

我得到一个语法错误“预期”,“但找到了标识符”,我不太清楚为什么

tell application "Google Chrome"
    tell document 1 to set failedTest to (do JavaScript "document.getElementsByClassName('specDetail failed')[0].getElementsByTagName('a')[0].title;")
end tell
在这里,它的突出显示JavaScriptChrome没有“DoJavaScript”命令。尝试“执行javascript”

tell application "Google Chrome"
    tell document 1 to set failedTest to (do JavaScript "document.getElementsByClassName('specDetail failed')[0].getElementsByTagName('a')[0].title;")
end tell