看起来像这样 id("ctl05_cbMulti_DropDown")/div[@class="rcbScroll rcbWidth"]/ul[@class="rcbList"]/li[@class="rcbHovered"]/label[1]/input[@ class="rcbCheckBox"]这些都不起作用司机。findElement(By.xpath("(//input[@type='checkbox'])[2]")).click(); 或 driver.findElement(By.id("ctl05_ctl03_cblUser_Input")).sendKeys("Smith, John");
3 回答
![?](http://img1.sycdn.imooc.com/545862db00017f3402200220-100-100.jpg)
一只斗牛犬
TA贡献1784条经验 获得超2个赞
我在您的第一行代码中看到了一些错误。您不应该在 xpath 中传递“(”。
正确的代码应该是:
new WebDriverWait(driver, 30).until(ExpectedConditions.ElementToBeClickable (By.xpath("//input[@type='checkbox'][2]")));
driver. findElement(By.xpath("//input[@type='checkbox'][2]").click();
添加回答
举报
0/150
提交
取消