如何使用Selenium VBA单击网页上的复选框 [英] How to click on checkbox on webpage using selenium vba
本文介绍了如何使用Selenium VBA单击网页上的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个查询,如何使用硒vba单击网页上的复选框.
I have a query,how to click on checkbox on webpage using selenium vba.
下面是我要单击的屏幕截图
Below is the screen shot where i want to click
下面是html代码.
<span name="locSpans[]" value="Nerul" style="display:block">
<input type="checkbox" name="locArr[]" value="8897" onclick="enableDisableLocality(); showSelectedLoc();">Nerul
<br>
<input type="hidden" name="locArrVal[]" disabled="disabled" value="Nerul">
</span>
推荐答案
您可以在下面使用xpath来获取复选框,这意味着:查找带有type ="checkbox"的输入和带有文本"Nerul"的父SPAN.
You can use xpath below to get checkbox, it means: find input with type="checkbox" and parent SPAN with text "Nerul".
driver.FindElementByXPath("//input[ancestor::span[normalize-space(.)='Nerul'] and @type='checkbox']").Click
这篇关于如何使用Selenium VBA单击网页上的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文