【发布时间】:2016-12-26 20:16:44
【问题描述】:
下面是两个复选框的 html,我的意图是选择一个复选框,使用它的标签作为“XERU”或“SYM”。在 Robot Framework 中,关键字 'Checkbox Should Be Selected' 使用 Key 属性; ID 和名称作为它的定位器,但这里的 ID 对于每个标签都是动态的。
所以我需要为选择它的 ID / 名称的复选框设置一个 Xpath,但不要在测试套件中硬编码。
<input id="ctl00_PageBody_chklistVirtualAddressingGroups_5" name="ctl00$PageBody$chklistVirtualAddressingGroups$5" type="checkbox"/>
<label for="ctl00_PageBody_chklistVirtualAddressingGroups_5">XERU</label>
<br/>
<input id="ctl00_PageBody_chklistVirtualAddressingGroups_6" name="ctl00$PageBody$chklistVirtualAddressingGroups$6" type="checkbox"/>
<label for="ctl00_PageBody_chklistVirtualAddressingGroups_6">SYM</label>
<br/>
【问题讨论】:
标签: checkbox selenium-webdriver robotframework selenium2library