如何使用java selenium在jsp页面中单击vue js呈现的按钮

如何使用java selenium在jsp页面中单击vue js呈现的按钮,java,selenium,vue.js,automated-tests,Java,Selenium,Vue.js,Automated Tests,我试图在jsp页面中获得vue js呈现的按钮。对于普通jsp页面,我可以使用xpath查找元素,但找不到vue.js呈现的元素 例如,我的jsp页面包含 <div id="fileUploadDiv" style="display: flex; border: medium none; height: 620px;"> <object id="mlFirstResponse" style="flex:1;display:flex;border: none;" type="te

我试图在jsp页面中获得vue js呈现的按钮。对于普通jsp页面,我可以使用xpath查找元素,但找不到vue.js呈现的元素

例如,我的jsp页面包含

<div id="fileUploadDiv" style="display: flex; border: medium none; height: 620px;">
<object id="mlFirstResponse" style="flex:1;display:flex;border: none;" type="text/html" data="/abc/index.html?abcId=0&amp;=editingPolicy=false&amp;objectHeight=480">
.
.
.
<div data-v-010855a7="" style="width: 100%; float: right;">
<button data-v-1f92dc12="" data-v-010855a7="" class="btn outline" id="clickable_id" style="float:right;padding: 5px 20px;font-size: 13px;">Continue to next page</button>
</div>
.
.
</object>

</div>
类似地,我尝试使用id=“clickable\u id”获取按钮,如


但是我没有发现这样的元素异常错误

可能是在完成加载后,按钮正在加载,即属性等于
完成
,并且按钮仍然不在那里,因为它是通过请求添加的

考虑添加,以便WebDriver可以等待更多的时间,直到按钮出现,可以使用和类组合来完成,如:

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement myButton = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("clickable_id")));

更多信息:

可能是在完成加载后,按钮正在加载,即属性等于完成,并且按钮仍然不在那里,因为它是通过请求添加的

考虑添加,以便WebDriver可以等待更多的时间,直到按钮出现,可以使用和类组合来完成,如:

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement myButton = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("clickable_id")));

更多信息:

谢谢您的回复。我们尝试过这样做,但仍然面临同样的问题。new.WebDriverWait(driver,20).until(ExpectedConditions.presenceOfElementLocated(By.id)(“clickable_id”));我使用了FluenWait,也使用了隐式等待,但仍然得到相同的例外谢谢你的回复。我们这样尝试过,但仍然面临相同的问题。new.WebDriverWait(driver,20).until(ExpectedConditions.presenceOfElementLocated(By.id)(“clickable_id”));我使用了FluenWait,也使用了隐式等待,但仍然得到相同的异常
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement myButton = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("clickable_id")));