2 Replies Last post: Aug 2, 2005 4:45 PM by Serge Piletsky  
Revanth A   2 posts since
Apr 24, 2006
Currently Being Moderated

Aug 2, 2005 2:56 PM

javascript alert boxes

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

orel ero   19 posts since
Apr 24, 2006
Currently Being Moderated
1. Aug 2, 2005 4:27 PM in response to: Revanth A
Re: javascript alert boxes

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

 

Serge Piletsky TeamDev Ltd. 670 posts since
Apr 24, 2006
Currently Being Moderated
2. Aug 2, 2005 4:45 PM in response to: Revanth A
Re: javascript alert boxes

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.

 

More Like This

  • Retrieving data ...