动作:
我想使用以下xpath检查复选框
WebElement checkBoxSelection = driver.findElement(By.xpath("//*[@id='tblusref']/tbody/tr[1]/td[2]/input"));
checkBoxSelection.click();
我的xpath是正确的,也是使用chrome开发人员工具验证的,但在执行期间它没有点击复选框,我没有得到任何异常
同样它在Firefox驱动程序中的完美工作,它不适用于Chrome和IE, 请帮助我如何解决这个问题
驱动程序依赖
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.53.1</version>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
<version>2.42.2</version>
答案 0 :(得分:0)
try to update to version 3.X
update the chrome driver also
i am adding a method that can help u debug
it highlight the place you click
(please use shorter path and if u can change it to css selector)
public void highligh(By cssSelector) {
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].style.border='2px groove green'", driver.findElement(cssSelector));
}