[英]How to Access Model Dialog Box content developed in Bootstrap using Selenium Web Driver and Java
I am trying to access model dialogue box (developed in Bootstrap) using Selenium Web Driver in Java, I am unable to do so. 我正在尝试使用Java中的Selenium Web Driver访问模型对话框(由Bootstrap开发)。 Here i wan tot access Title, Content and Button.
在这里,我想访问标题,内容和按钮。
One more point is here xPath is dynamic, every time xPath is generating differently. 还有一点是,每次xPath生成不同时,xPath都是动态的。 I know that can be solved by partially matching the xPath.
我知道可以通过部分匹配xPath来解决。
So help me to solve this problem. 所以帮我解决这个问题。 Here I am attaching image of my model box design.
在这里,我将附加我的模型盒设计的图像。
Here is code snippet 这是代码片段
Here is code 这是代码
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="bootstrap-dialog-header">
<div class="bootstrap-dialog-close-button" style="display: none;">
<button class="close">
×
</button>
</div>
<div class="bootstrap-dialog-title" id="5f663313-d82d-4ab8-9712-6665e80a3654_title">
Member Registration
</div>
</div>
</div>
<div class="modal-body">
<div class="bootstrap-dialog-body">
<div class="bootstrap-dialog-message">
Sample Message Sample Message Sample Message Sample Message Sample Message Sample Message.
</div>
</div>
</div>
<div class="modal-footer">
<div class="bootstrap-dialog-footer">
<div class="bootstrap-dialog-footer-buttons">
<button class="btn btn-primary" id="353ab962-44d3-497f-8318-6db703b460d8">
Ok
</button>
</div>
</div>
</div>
</div>
</div>
//div[@class="bootstrap-dialog-title"] for Title
//div[@class="bootstrap-dialog-message"] for message
//div[@class="bootstrap-dialog-footer-buttons"]/button for buttton
driver.switchTo().activeElement();
Thread.sleep(5000);
driver.findElement(By.xpath("//button[contains(text(),'"+data+"')]")).click();
This Solve My Problem , I also wants to access Message but i am unable to access 此解决了我的问题,我也想访问消息,但我无法访问
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.