I want to know the message text on text box of a javascript alert.
How can I check it?
Also how to click ok cancel etc..buttons when an alert box appears...How can I do that?
Regards,
Revanth A
for the first one, i have no clue, but for the second u can simulate a click on the button ok/cancel with the robot class from the java sdk
In the JExplorer API there is the ability to set the custom instance of DialogEventHandler that will allow you to intercept all JavaScript dialogs (such as alert and confirm dialogs) and get the title, message and type of the dialog.
The sample below demonstrates how it works:
WebBrowser browser = ...;
browser.setDialogEventHandler(new DialogEventHandler() {
public int showDialog(Wnd wnd, String title, String text, int type) {
System.out.println("title = " + title);
System.out.println("text = " + text);
System.out.println("type = " + type);
return MessageBox.IDOK;
}
});
And as you can see, in the showDialog function you can return the necessary value to simulate user input.