gpt4 book ai didi

javascript - 使用 Applescript 从 Javascript 下拉菜单中选择选项 - 如何?

转载 作者:行者123 更新时间:2023-11-28 01:15:01 24 4
gpt4 key购买 nike

像这样使用applescript

set settrimsize to "'7.440" x 9.690" (246mm x 189mm)'"
tell application "Safari"
do JavaScript "document.forms['aspnetForm']['_ctl0:_ctl0:MainContent:MainContent:ctlBookTypeSelector:ddlTrimSize'].value = " & settrimsize in document 1
end tell

应该可以从此列表中选择一个选项

<tr id="trimSizeRow">

<td align="right" class="formLabelSmallRight">
<label>Trim Size</label>
</td>
<tr id="trimSizeRow">

<td align="right" class="formLabelSmallRight">
<label>Trim Size</label>
</td>
<td align="left" width="60%">
<select name="_ctl0:_ctl0:MainContent:MainContent:ctlBookTypeSelector:ddlTrimSize" id="_ctl0__ctl0_MainContent_MainContent_ctlBookTypeSelector_ddlTrimSize">
<option selected="selected" value=""></option>
<option value="4.370&quot; x 7.000&quot; (178mm x 111mm)">4.370&quot; x 7.000&quot; (178mm x 111mm)</option>
<option value="4.72&quot; x 7.48&quot; (190mm x 120mm) ">4.72&quot; x 7.48&quot; (190mm x 120mm) </option>
<option value="5.000&quot; x 7.000&quot; (178mm x 127mm)">5.000&quot; x 7.000&quot; (178mm x 127mm)</option>
<option value="5.000&quot; x 8.000&quot; (203mm x 127mm)">5.000&quot; x 8.000&quot; (203mm x 127mm)</option>
<option value="5.060&quot; x 7.810&quot; (198mm x 129mm)">5.060&quot; x 7.810&quot; (198mm x 129mm)</option>
<option value="5.250&quot; x 8.000&quot; (203mm x 133mm)">5.250&quot; x 8.000&quot; (203mm x 133mm)</option>
<option value="5.500&quot; x 8.500&quot; (216mm x 140mm)">5.500&quot; x 8.500&quot; (216mm x 140mm)</option>
<option value="5.830&quot; x 8.270&quot; (210mm x 148mm) A5">5.830&quot; x 8.270&quot; (210mm x 148mm) A5</option>
<option value="6.000&quot; x 9.000&quot; (229mm x 152mm)">6.000&quot; x 9.000&quot; (229mm x 152mm)</option>
<option value="6.140&quot; x 9.210&quot; (234mm x 156mm)">6.140&quot; x 9.210&quot; (234mm x 156mm)</option>
<option value="6.690&quot; x 9.610&quot; (244mm x 170mm)">6.690&quot; x 9.610&quot; (244mm x 170mm)</option>
<option value="7.000&quot; x 10.00&quot; (254mm x 178mm)">7.000&quot; x 10.00&quot; (254mm x 178mm)</option>
<option value="7.440&quot; x 9.690&quot; (246mm x 189mm)">7.440&quot; x 9.690&quot; (246mm x 189mm)</option>
<option value="7.500&quot; x 9.250&quot; (235mm x 191mm)">7.500&quot; x 9.250&quot; (235mm x 191mm)</option>
<option value="8.000&quot; x 10.00&quot; (254mm x 203mm)">8.000&quot; x 10.00&quot; (254mm x 203mm)</option>
<option value="8.000&quot; x 10.88&quot; (276mm x 203mm)">8.000&quot; x 10.88&quot; (276mm x 203mm)</option>
<option value="8.000&quot; x 8.000&quot; (203mm x 203mm)">8.000&quot; x 8.000&quot; (203mm x 203mm)</option>
<option value="8.250&quot; x 11.00&quot; (280mm x 210mm)">8.250&quot; x 11.00&quot; (280mm x 210mm)</option>
<option value="8.268&quot; x 11.693&quot; (297mm x 210mm) A4">8.268&quot; x 11.693&quot; (297mm x 210mm) A4</option>
<option value="8.500&quot; x 11.00&quot; (280mm x 216mm)">8.500&quot; x 11.00&quot; (280mm x 216mm)</option>
<option value="8.500&quot; x 8.500&quot; (216mm x 216mm)">8.500&quot; x 8.500&quot; (216mm x 216mm)</option>
<option value="8.500&quot; x 9.000&quot; (229mm x 216mm)">8.500&quot; x 9.000&quot; (229mm x 216mm)</option>

</select>
</td>
</tr>

..但事实并非如此 - 我已经盯着它看了有一段时间了,有点找不到如何让它工作 - 任何帮助我都会非常感激。

谢谢!

最佳答案

尝试:

set settrimsize to "7.440\" x 9.690\" (246mm x 189mm)"

tell application "Safari"
tell current tab of window 1
do JavaScript "document.getElementById('_ctl0__ctl0_MainContent_MainContent_ctlBookTypeSelector_ddlTrimSize').value='" & settrimsize & "';"
end tell
end tell

关于javascript - 使用 Applescript 从 Javascript 下拉菜单中选择选项 - 如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23945347/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com