如何使用applescript检查收音机盒?
我试过这个,但只是“缺少价值”
do JavaScript "var elements = document.getElementsByName('radiobs');
for (i=0;i<elements.length;i++) {
if(elements[i].value == 'Help') {
elements[i].checked = true;
}
}" in document 1
这是收音机盒:
<input name="radiobs" id="radiobs" type="radio" value="No help">
<input name="radiobs" id="radiobs" type="radio" value="Help">
<input name="radiobs" id="radiobs" type="radio" value="Some help">
答案 0 :(得分:0)
在Chrome中调用Javascript的方式有所不同:
tell application "Google Chrome"
tell window 1
execute tab (active tab index) javascript "var elements = document.getElementsByName('radiobs');
for (i=0;i<elements.length;i++) {
if(elements[i].value == 'Help') {
elements[i].checked = true;
}
}"
end tell
end tell