【发布时间】:2014-11-26 14:27:59
【问题描述】:
我们可以使用 JavaScript 向 Cocoa 应用程序中的 webview 内的按钮发送点击事件吗?
我正在尝试使用实用程序 (Yosemite) 下的脚本编辑器进行记录,但遗憾的是无法记录 webview 中的任何事件。
我尝试将 Apple 文档中提供的 UI 自动化部分下的示例代码与 https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html 的 testapp(带有 webview 的可可应用)一起使用。
TestApp = Application('TestApp')
TestApp.activate()
delay(1)
SystemEvents = Application('System Events')
TestApp = SystemEvents.processes['TestApp']
TestApp.document.getElementById('testid').click(); // stuck at this last line not sure if I can
//even call the document object in this way. Getting error undefined variable document.
【问题讨论】:
标签: javascript cocoa osx-yosemite javascript-automation