Selenium Web驅(qū)動(dòng)程序和Java。元素在點(diǎn)(x,y)處不可點(diǎn)擊。其他元素將收到點(diǎn)擊我使用了明確的等待,我有警告:org.openqa.selenium.WebDriverException:元素在點(diǎn)(36,72)處不可點(diǎn)擊。其他元素將收到點(diǎn)擊:...命令持續(xù)時(shí)間或超時(shí):393毫秒如果我使用Thread.sleep(2000)我沒有收到任何警告。@Test(dataProvider = "menuData")public void Main(String btnMenu, String TitleResultPage, String Text) throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 10);
driver.findElement(By.id("navigationPageButton")).click();
try {
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(btnMenu)));
} catch (Exception e) {
System.out.println("Oh");
}
driver.findElement(By.cssSelector(btnMenu)).click();
Assert.assertEquals(driver.findElement(By.cssSelector(TitleResultPage)).getText(), Text);}
4 回答

人到中年有點(diǎn)甜
TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個(gè)贊
如果您需要使用Javascript
我們可以使用參數(shù)[0] .click()來模擬點(diǎn)擊操作。
var element = element(by.linkText('webdriverjs'));browser.executeScript("arguments[0].click()",element);
添加回答
舉報(bào)
0/150
提交
取消