Example: ctrx_sync_on_bitmap_change

The following example launches Microsoft's Internet Explorer after connecting to the Citrix server ludens. The test run 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_change 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 deemed a success.

Actions () {
     int rc;

     ctrx_connect_server("ludens", "test", "test", "ludens");

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

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


     /* 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");

     /* 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_change(137, 211, 51, 17, CTRX_LAST );

     if (rc != E_OK)
          lr_end_transaction("news_item", LR_FAIL);
          lr_end_transaction("news_item", LR_PASS);

     /* 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");

     return 0;