Dialogs and Popups in Java or Javascript

I need to manipulate Popups and Download Dialogs of IE browser using Java or Javascript-based Automated Solution.

I tried with selenium2, but it did not work properly, so any other suggestion for it. Actually selenium2 does not provide proper handling of alert / download dialogs, so I am thinking of using a different javascript / java solution.

With Download Dialog: I need to save the downloaded file to a specific location. In the Alerts dialog box: I need to check the displayed message and click on a specific button.

Any suggestion is welcome. Thank.

+1
source share
1 answer

1, .

    //Click on browse file button, open a popup
    selenium.click("//input[@value='Browse...']");

    //waiting for popup to load
    selenium.waitForPopUp("_Dialog", "30000");

    //selecting the popup by passing window name
    selenium.selectWindow("name=_Dialog");

    //click a link inside pop up window
    selenium.click("link=something");

    //Put other popup operations here

    //click cancel button for pop up
    selenium.click("cancel");

    //back to main window
    selenium.selectwindow("null")

, selenium.getAlert();. , String.

, - , .

        int noofWindows = selenium.getAllWindowNames().length;
        if (noofWindows > 1){
        //selects the second window 
        selenium.selectWindow(selenium.getAllWindowIds()[2]);
        //Prints the message in the alert window
        System.out.println(selenium.getAlert());
        }

IE, firefox (* chrome) .

, .

* JavaScript. , Vb- script .

, IE download pop up - Windows, selenium , Java AWT AutoIT.

AutoIT script

WinWaitActive(windowTitle)
ControlClick(windowTitle,"",buttonName)

IEsave.exe. . AutoIT script.

IEsave.exe . java .

java.lang.Runtime.getRuntime().exec("c:/IEsave.exe");

, .

exe .

, .

+2

All Articles