HTML:
button type="button" class="btn btn-primary" onclick="document.getElementById('formChangePIN').submit();">Submit</button
码:
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button[class='btn btn-primary']"))).click();
而此代码在运行时工作
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\\\"blockCardModal\\\"]/div/div/div[3]/button[2]"))).click();
尝试使用窗口句柄在窗口之间切换并执行单击操作
或使用动作驱动程序单击
WebElement element = driver.findElement(locator)
actions.moveToElement(element).click().perform();