Quantcast
Channel: All LoadRunner Practitioners Forum posts
Viewing all articles
Browse latest Browse all 12134

Re: OS Pop up recognition in TrueClient

$
0
0

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

 


Viewing all articles
Browse latest Browse all 12134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>