HomeOATS

Close all open Oracle EBS forms except Navigator window in OpenScript – OFT – OATS

Close all open Oracle EBS forms except Navigator window in OpenScript – OFT – OATS
Like Tweet Pin it Share Share Email

Many a times when working with Oracle EBS forms, automation test engineer wants to bring forms to base state and continue with next steps, this can be achieved very easily using OATS. There is an api given as part of forms object, which is getAllOpenWindows(), this method in forms returns List of AbstractWindows, you can write a for loop to navigate through all windows and check if the name attribute is not navigator and close all the forms other than navigator.

For users convenience we are giving a ready made function for the above purpose.

Code Snippet for bringing Oracle EBS Forms to Base state by closing all open windows except for Navigator Window

public void formsBaseState() throws Exception
{
    // get all open windows in the current state of execution
    AbstractWindow allwindows[]=forms.getAllOpenWindows();

    //iterate through all windows and close all the windows except for the navigator window
    for(int i=0;i<allwindows.length;i++)
    {
        // check if the current window is not a navigator window
       if(allwindows[i].getAttribute("name")!=null && !allwindows[i].getAttribute("name").equals("NAVIGATOR"))
       {
           if(allwindows[i].exists())
           {
                allwindows[i].activate(true);
                String nm=allwindows[i].getAttribute("name");
                forms.window("//forms:window[(@name='"+nm+"')]").selectMenu("File|Close Form");
                think(2);
           }
       }
    }
}

Note: the above code snippet works for a pure positive case when there wont be any issues in closing each window, you could add additional code to handle situations where windows like Caution Window / Alert Window / Decision Window might appear whenever each window is closed. Just make sure that the function may not get delayed.

lambdatest

Comments (1)

Leave a Reply

Your email address will not be published. Required fields are marked *