如何让 AppleScript 和 jQuery 触发“.click()” Safari 中的事件
我正在尝试获取一些 javascript 代码,并将 jQuery 加载到 AppleScript 中,以触发“.click()”事件。
下面是有问题的代码:
var dayIdValue1 = 'z_event_date_picker_calendar_0_cell' + dayValue2;
var dayTd = document.getElementById(dayIdValue1).childNodes[0];
dayTd.click();
可能值得一提的是,我尝试让 jQuery 加载带有变量 dayIdValue1 的选择器,但我无法让它正常工作。
另外值得补充的是,我正在使用 Safari 来运行脚本,但它不断引发如下错误:
TypeError: 'undefined' is not a function (evaluating 'dayTd.click()')
您必须就此事提供的任何帮助都会有所帮助。
提前致谢。
I am trying to get some javascript code, with jQuery loaded in an AppleScript, to fire a '.click()' event.
Here's a look at the code in question:
var dayIdValue1 = 'z_event_date_picker_calendar_0_cell' + dayValue2;
var dayTd = document.getElementById(dayIdValue1).childNodes[0];
dayTd.click();
It's probably worth mentioning that I tried to get jQuery to load a selector with the variable dayIdValue1, but I couldn't get it to work without an error.
Also it's worth adding, that I am using Safari to run the script, but it keeps firing an error like this:
TypeError: 'undefined' is not a function (evaluating 'dayTd.click()')
Any help you would have to offer on the matter would be helpful.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的评论,它是一个链接,您可以使用
getElementsByTagName
来引用锚标记。对于 jQuery,这只是
假设
dayIdValue1
是一个有效的 id。based on your comment that it is a link, you can use
getElementsByTagName
to reference the anchor tag.With jQuery it would just be
this assumes that
dayIdValue1
is a valid id.