Example: ctrx_sync_on_bitmap

The following example launches Microsoft's Internet Explorer after connecting to the Citrix server ludens. The script waits for the browser window to appear using ctrx_set_window.

The example then navigates to a URL that has a navigation frame. Every item in the frame loads another news story, but the title of the window ("News - Microsoft Internet Explorer") remains the same. Therefore, ctrx_set_window is not generated. In this case, a call to ctrx_sync_on_bitmap is inserted to wait for the change in the text that indicates that the new story has been loaded. If it loads successfully, the transaction news_item is a success.

Actions () {
     int rc;
     ctrx_connect_server("ludens", "test", "test", "ludens");
     ctrx_wait_for_event("LOGON");

     /* Launch the web browser by clicking on desktop IE icon */
     ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, NULL);
     lr_think_time(13);

     /* Wait for browser window to appear */
     ctrx_set_window("Nasdaq liveQUOTES - Microsoft Internet Explorer");
     lr_think_time(8);
     lr_start_transaction("news_item");

     /* Go to the "NEWS" tab */
     ctrx_mouse_click(133, 186, LEFT_BUTTON, 0, 
               "The Nasdaq Stock Market - Microsoft Internet Explorer");

     ctrx_set_window("News - Microsoft Internet Explorer");
     lr_think_time(7);

     /* Click on a news item in the left frame */
     ctrx_mouse_double_click(198, 320, LEFT_BUTTON, 0, 
               "News - Microsoft Internet Explorer");

     /* Wait for news item to appear to appear */
     rc = ctrx_sync_on_bitmap(137, 211, 51, 17,
                "18d962dcbf373e948e83489a19419512");

     /* Exit the web browser by clicking on top left Exit check box */
     ctrx_mouse_click(573, 61, LEFT_BUTTON, 0, 
               "Welcome to MSN.com - Microsoft Internet Explorer");

     lr_think_time(12);
     ctrx_disconnect_server("ludens");
     return 0;
}