像这样使用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" x 7.000" (178mm x 111mm)">4.370" x 7.000" (178mm x 111mm)</option>
<option value="4.72" x 7.48" (190mm x 120mm) ">4.72" x 7.48" (190mm x 120mm) </option>
<option value="5.000" x 7.000" (178mm x 127mm)">5.000" x 7.000" (178mm x 127mm)</option>
<option value="5.000" x 8.000" (203mm x 127mm)">5.000" x 8.000" (203mm x 127mm)</option>
<option value="5.060" x 7.810" (198mm x 129mm)">5.060" x 7.810" (198mm x 129mm)</option>
<option value="5.250" x 8.000" (203mm x 133mm)">5.250" x 8.000" (203mm x 133mm)</option>
<option value="5.500" x 8.500" (216mm x 140mm)">5.500" x 8.500" (216mm x 140mm)</option>
<option value="5.830" x 8.270" (210mm x 148mm) A5">5.830" x 8.270" (210mm x 148mm) A5</option>
<option value="6.000" x 9.000" (229mm x 152mm)">6.000" x 9.000" (229mm x 152mm)</option>
<option value="6.140" x 9.210" (234mm x 156mm)">6.140" x 9.210" (234mm x 156mm)</option>
<option value="6.690" x 9.610" (244mm x 170mm)">6.690" x 9.610" (244mm x 170mm)</option>
<option value="7.000" x 10.00" (254mm x 178mm)">7.000" x 10.00" (254mm x 178mm)</option>
<option value="7.440" x 9.690" (246mm x 189mm)">7.440" x 9.690" (246mm x 189mm)</option>
<option value="7.500" x 9.250" (235mm x 191mm)">7.500" x 9.250" (235mm x 191mm)</option>
<option value="8.000" x 10.00" (254mm x 203mm)">8.000" x 10.00" (254mm x 203mm)</option>
<option value="8.000" x 10.88" (276mm x 203mm)">8.000" x 10.88" (276mm x 203mm)</option>
<option value="8.000" x 8.000" (203mm x 203mm)">8.000" x 8.000" (203mm x 203mm)</option>
<option value="8.250" x 11.00" (280mm x 210mm)">8.250" x 11.00" (280mm x 210mm)</option>
<option value="8.268" x 11.693" (297mm x 210mm) A4">8.268" x 11.693" (297mm x 210mm) A4</option>
<option value="8.500" x 11.00" (280mm x 216mm)">8.500" x 11.00" (280mm x 216mm)</option>
<option value="8.500" x 8.500" (216mm x 216mm)">8.500" x 8.500" (216mm x 216mm)</option>
<option value="8.500" x 9.000" (229mm x 216mm)">8.500" x 9.000" (229mm x 216mm)</option>
</select>
</td>
</tr>
..但它没有 - 我已经盯着它看了一会儿,有点找不到如何让它起作用 - 任何帮助都会让我非常感激。
谢谢!
答案 0 :(得分:1)
尝试:
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