Java 我无法单击“继续”按钮或“退出”按钮继续下一页

Java 我无法单击“继续”按钮或“退出”按钮继续下一页,java,selenium,xpath,selenium-webdriver,Java,Selenium,Xpath,Selenium Webdriver,我什么都试过了。我也无法追踪 <button accesskey="c" id="Continue" class="jfabtn" type="button" onclick="submitForm()"><u>C</u>ontinue</button> 或 或 请尝试以下代码: driver.findElement(By.xpath("//**Enter here class name of that element**[contains(@

我什么都试过了。我也无法追踪

<button accesskey="c" id="Continue" class="jfabtn" type="button" onclick="submitForm()"><u>C</u>ontinue</button>

请尝试以下代码:

driver.findElement(By.xpath("//**Enter here class name of that element**[contains(@id,'Exit')]")).click();

尝试使用javascript执行器方法单击按钮


你能更明确地说明我不能点击吗?您是否得到任何异常?因为您在这里没有提到任何错误,所以我假设通过执行上述代码,您不会得到任何错误,所以请尝试使用javascript Executor方法单击按钮元素。有关此问题的更多详细信息,请参阅下面我的答案。您需要检查框架。如果存在任何帧,则需要首先切换到帧..参考:-参考:-为什么OP应输入该元素的类名而不是节点名?为什么指定部分id值比指定确切id好?如果对您有用,请将此答案标记为已接受。
driver.findElement(By.xpath("//*[@id=Continue]");
<button accesskey="x" id="Exit" class="jfabtn" type="button" onclick="exit()">E<u>x</u>it</button>
driver.findElement(By.id("Exit")).click();
driver.findElement(By.xpath("//*[@id=Exit]");
driver.findElement(By.xpath("//**Enter here class name of that element**[contains(@id,'Exit')]")).click();
WebElement button = driver.findElement(By.id("Continue"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", Continue);