Selenium IDE:如何取消选择 multi <SELECT> 中的所有选项
Selenium IDE: How to unselect all options in a multi <SELECT>
我搜索了这个问题没有找到,所以我自己发布。我的网页有多个 select,如下所示。所有选项都在页面加载时 selected 并且使用 Selenium IDE 我想取消 select 所有选项并提交表单以确保出现正确的错误消息。有什么建议吗?
Mavbe 在 'runScript' 命令中嵌入了一些东西??只能在这里使用 IDE 而不能使用 Webdriver...
<select id="example" multiple="multiple>
<option selected="selected" value="1">abc</option>
<option selected="selected" value="2">def</option>
<option selected="selected" value="1">ghi</option>
</select>
我找到了我的问题的解决方案并认为我会分享。 JavaScript 可以使用:
getEval | var elements = window.document.getElementById("example").options; for(var i = 0; i < elements.length; i++){elements[i].selected = false;}
我搜索了这个问题没有找到,所以我自己发布。我的网页有多个 select,如下所示。所有选项都在页面加载时 selected 并且使用 Selenium IDE 我想取消 select 所有选项并提交表单以确保出现正确的错误消息。有什么建议吗?
Mavbe 在 'runScript' 命令中嵌入了一些东西??只能在这里使用 IDE 而不能使用 Webdriver...
<select id="example" multiple="multiple>
<option selected="selected" value="1">abc</option>
<option selected="selected" value="2">def</option>
<option selected="selected" value="1">ghi</option>
</select>
我找到了我的问题的解决方案并认为我会分享。 JavaScript 可以使用:
getEval | var elements = window.document.getElementById("example").options; for(var i = 0; i < elements.length; i++){elements[i].selected = false;}