首页 > 解决方案 > Selenium - xpath 定义

问题描述

我正在尝试使用以下 xpath 来复选框“处理中”

我正在使用以下代码,但得到一个No such Element Exception

String ds = "//*[@id='ctl00_ctl00_Content_MainPlaceHolder_cblStatuses_1']";
driver.findElement(By.xpath(ds)).click();

标签: seleniumxpath

解决方案


要完成和添加额外的安全层,您可以使用以下 XPath:

//table[@empowertype="CheckBoxList"][preceding::label[1][.="Statuses"]]//input[@type="checkbox" and @value="In Process"]

输出:1 个input元素


推荐阅读