Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..
794 views

OS Pop up recognition in TrueClient

Jump to solution

Hello,

One of the old issues with TC is recognition of external OS pop ups.  With 12.5 coming in , did we get any workaroud by using javascript to recognize the OS pop up box and press cancel/save in it . I have a step in UI which opens a pop up to save/open/cancel an excel file.  If i do not not press any button in this step and continue to next steps, the next iteration fails as the file operation is still not completed. I tried few of the JS (self.close() etc.) snippets but it did not work. Without using other automation tools than LR, did anyone face this issue recently and got any solutionTC?  The application is build on Qliksense and Http/html protocol does not recognize the objects, thus we are using TC IE (parsing header with use of fidler would be troublesome for 25 scripts!!)

Reference from an old thread:

/t5/LoadRunner-Practitioners-Forum/Pop-up-recognition-in-Ajax-Tru-Client-Protocol/td-p/6018407

@Shlomi@JamesPulley

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: OS Pop up recognition in TrueClient

Jump to solution

Hi,

This can be done using C function.

Below you can find an example for such a function. Read the code, understand what it is doing and modify it to do what you need.

Add Evaluate C step in the right timing in the script/.sidebar. It is advised to add a Wait step before the Evaluate C step in order to ensure the modal dialog really appears.

void pressButton() 
{
    int nDownloadWindow;
    int nButton;
    
    lr_load_dll("Kernel32.dll");
    lr_load_dll("User32.dll");
   
    nDownloadWindow = FindWindowA(0, "File Download - Security Warning"); // change the title according to your case
    if (nDownloadWindow != 0) 
    {
        lr_output_message("found download window %u", nDownloadWindow);
        PostMessageA(nDownloadWindow, 256, 27, 0); // you can get the coordinates of the button using Spy++ or other object inspector
        PostMessageA(nDownloadWindow, 257, 27, 0);
    }
    else  //fallback in case the window title is different
    {
        nDownloadWindow = FindWindowA(0, "File Download");
        if (nDownloadWindow != 0) 
        {
            lr_output_message("found download window %u", nDownloadWindow);
            // Open button - 4426
            // Save button - 4427
            nButton = GetDlgItem(nDownloadWindow, 4426); // 4426, ID of open button
            if (nButton != 0)
            {
                        PostMessageA(nButton, 245, 0, 0);
                        lr_output_message("found button window %u", nButton);
            }
            else 
            {
                        lr_output_message("Error button window %u", GetLastError());
            }
        }
    }
}

You can define a parameter for the window title and use it in the C code.

Good luck,

Shlomi

 

View solution in original post

0 Likes
1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: OS Pop up recognition in TrueClient

Jump to solution

Hi,

This can be done using C function.

Below you can find an example for such a function. Read the code, understand what it is doing and modify it to do what you need.

Add Evaluate C step in the right timing in the script/.sidebar. It is advised to add a Wait step before the Evaluate C step in order to ensure the modal dialog really appears.

void pressButton() 
{
    int nDownloadWindow;
    int nButton;
    
    lr_load_dll("Kernel32.dll");
    lr_load_dll("User32.dll");
   
    nDownloadWindow = FindWindowA(0, "File Download - Security Warning"); // change the title according to your case
    if (nDownloadWindow != 0) 
    {
        lr_output_message("found download window %u", nDownloadWindow);
        PostMessageA(nDownloadWindow, 256, 27, 0); // you can get the coordinates of the button using Spy++ or other object inspector
        PostMessageA(nDownloadWindow, 257, 27, 0);
    }
    else  //fallback in case the window title is different
    {
        nDownloadWindow = FindWindowA(0, "File Download");
        if (nDownloadWindow != 0) 
        {
            lr_output_message("found download window %u", nDownloadWindow);
            // Open button - 4426
            // Save button - 4427
            nButton = GetDlgItem(nDownloadWindow, 4426); // 4426, ID of open button
            if (nButton != 0)
            {
                        PostMessageA(nButton, 245, 0, 0);
                        lr_output_message("found button window %u", nButton);
            }
            else 
            {
                        lr_output_message("Error button window %u", GetLastError());
            }
        }
    }
}

You can define a parameter for the window title and use it in the C code.

Good luck,

Shlomi

 

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.