|
From: jp l. <jp....@gm...> - 2017-08-02 23:00:18
|
Hi there.
I am trying to reach a button in a popup, but I can't get it ... I try
to follow only example that I found in the web ... here is my code,
maybe someone face the same and can help me:
final LinkedList<WebWindow> windows = new LinkedList<WebWindow>();
try (final WebClient webClient = new WebClient(BrowserVersion.getDefault())) {
webClient.setJavaScriptTimeout(5000);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.waitForBackgroundJavaScript(30000);
webClient.getOptions().setActiveXNative(true);
webClient.getOptions().setAppletEnabled(true);
webClient.getOptions().setCssEnabled(true);
webClient.getOptions().setUseInsecureSSL(true);
webClient.addWebWindowListener(new WebWindowListener() {
@Override
public void webWindowOpened(WebWindowEvent webWindowEvent) {
windows.add(webWindowEvent.getWebWindow());
}
@Override
public void webWindowContentChanged(WebWindowEvent
webWindowEvent) {
}
@Override
public void webWindowClosed(WebWindowEvent webWindowEvent) {
}
});
//.... code for getting the button that raise the popup
HtmlPage popupPage = (HtmlPage) windows.getLast(); // <- this is empty
this is the html that raise the popup
<input class="btn btn-success btn-lg create_lending_btn" type="submit"
value="Lending Offer">
this is the html for the pop up
<div class="bootbox modal fade in" tabindex="-1" role="dialog"
aria-hidden="false" style="display: block; padding-right: 15px;">
<div class="modal-backdrop fade in" style="height: 954px;"></div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="bootbox-close-button close"
data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Offer Details</h4>
</div>
<div class="modal-body">
<div class="bootbox-body">
<div>
</div>
</div>
</div>
<div class="modal-footer"><button data-bb-handler="cancel"
type="button" class="btn btn btn-danger">Cancel</button><button
data-bb-handler="confirm" type="button" class="btn btn
btn-success">Confirm</button></div>
</div>
</div>
</div>
After that the button is executing some Ajax Javascript
any ideas ?
thank you in advance.
|