<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<h1>Test</h1>
<hr>
<div id="a1">
<div id="a2">
<div id="a3">
<div class="hello">
<a href="http://google.com">Google</a>
</div>
</div>
</div>
</div>
</body>
</html>
网页如上所示,我找不到任何方法使用AppleScript点击它。我是AppleScript的新手。我搜索过谷歌,但没有一个在上面工作。
答案 0 :(得分:0)
尝试:
tell application "Safari"
tell current tab of window 1
do JavaScript "document.getElementsByClassName('hello')[0].firstElementChild.click()"
end tell
end tell