再次嗨,以上代码可用于选择星期,但不能选择时间
<td style="white-space:nowrap;">Master Timings</td>
<td>
<select name="ddlSTSun" id="ddlSTSun" onChange="return ChangeAllSTET(frmRosterInfoTLEmp,'ddlSTSun','ddlST1Sun02');" style="font-family:Arial;font-size:9pt;">
<option value="01:00">01:00</option>
<option value="02:00">02:00</option>
<option value="03:00">03:00</option>
<option value="04:00">04:00</option>
<option value="05:00">05:00</option>
<option value="06:00">06:00</option>
<option value="07:00">07:00</option>
我的VBA代码是
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("[name=cmbWeeks]").selectedIndex = "Week:-2 19-May-2019"
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("[name=cmbWeeks]").FireEvent ("onchange")
Sleep 5000
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("[name=ddlSTSun]").selectedIndex = "12:00"
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("[name=ddlSTSun]").FireEvent ("onchange")
答案 0 :(得分:0)
有一个ID,请先使用该ID。然后import 'react';
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
webview: Electron.WebviewTag
}
}
}
处于索引位置,例如1,2等不是时间值。
selectedIndex
您可以使用attribute = value选择器来指定时间:
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("#ddlSTSun").selectedIndex = 1
事件(如果需要):
ie.Document.getElementsByTagName("iframe")(0).contentDocument.querySelector("#ddlSTSun [value='12:00']").selected = True