Forum Discussion

AndersW's avatar
AndersW
Occasional Contributor
14 years ago

v8.00 TC doesn't wait for WebObjects like 7.52 did??

I have created some WebTests in v7.52, and they work fine. Whenever I activate a menu item to open a panel or frame, TC waits for the object to "finish" before moving to next step.



But in v8.00 it does not wait. So while my panel or frame is getting activated, TC have already moved on and reported that the item doesn't exist.



F.x. in the attached screen shot, I have activated the 'Application Control' object in the left panel. Now the frame is loading. In TC7.52, TC would wait for the frame to load before continuing. But TC8.00 just continues immediately, and then reports that the frame object does not exist.



How can I get TC8.00 to handle this situation like TC7.52 did??

7 Replies

  • AndersW's avatar
    AndersW
    Occasional Contributor
    Here is an example of how I would get to a certain page on our website:



    // ----------------------------------------

    // Test for SmartBear

    // ----------------------------------------

    procedure StartIExplorer;

    begin

      gLastTab := '';

      gLastMenu := '';

      MainBrowserProcess := Sys.WaitProcess('iexplore',500);

      browserProcess := Sys.WaitProcess('iexplore',500,2);

      if browserProcess.exists then begin

        if browserProcess.WaitWindow('#32770','*',-1,500).exists then

          browserProcess.Window('#32770').Window('Button','Cancel').Click;

        MainBrowserProcess.Close;

        sleep(1500);

        TestedApps.iexplore.Run;

        MainBrowserProcess := Sys.WaitProcess('iexplore',500);

        browserProcess := Sys.WaitProcess('iexplore',500,2);

      end    

      else

        TestedApps.iexplore.Run;

    end;



    function FindMFObject(ObjectName: OleVariant);

    begin

      iexplore := Aliases.iexplore;

      result := iexplore.pageNetcom.NetcomFrame.FindChild('Name','item(' + ObjectName + ')',60);

    end;



    procedure ActWebObj(ObjName: string);

    var

      WebObj: OleVariant;

    begin

      WebObj := FindMFObject(ObjName);

      WebObj.Keys('[Enter]');

    end;



    procedure NavPage(TabName, MenuName: string);

    begin

      browserProcess := Sys.Process('iexplore');

      MainFrame := Aliases.iexplore.pageNetcom.NetcomFrame;

      if not (gLastTab = TabName) then begin

        ActWebObj(TabName);

        gLastTab := TabName;

      end;

      MainPageFrame := MainFrame.page.Frame;

      if not (gLastMenu = MenuName) then begin

        if not (MenuName = '') then begin

          ActWebObj(MenuName);

          gLastMenu := MenuName;

        end;

      end;

    end;





    procedure OpenWebPageTest;

    begin

      StartIExplorer;

      NavPage(pgConfigDev,pgAppControl);

    end;


    // ----------------------------------------------------------



    Basically what I do, is open my Browser to the web page we want, then I activate first the Menu item (in the banner). Then the left panel is loaded (this can take a second or two sometimes), and while that is loading TC7 would wait with the next part of the NavPage procedure until it was loaded. Then it would find and activate the Tab item from the Left Panel. Then the Main frame would load, and again it would wait with further execution (now past the NavPage procedure).



    v8.00 doesn't wait. It just continues the script, and as it can't find my objects, then the test fails, and I am not sure why it doesn't wait like v7 does.
  • Hi,



    First of all, I recommend that you check the auto-wait timeout value in your project's properties (maybe, it is just too low). Second, use the WaitAliasChild method to obtain the object which you need to wait for.
  • AndersW's avatar
    AndersW
    Occasional Contributor
    Hey Jared



    I compared the Autowait values in both v8 and v7, and they are the same, so I still don't understand how v7 waits for my frame to load properly, while v8 doesn't.



    As for your second suggestion, I guess I would have to use either WaitAliasChild, WaitNamedChild or WaitChild depending on whether it is mapped or not?? ... that would mean that any function or procedure I have, has to test on WaitChild.exists to be usable in v8??



    Damn ... that is going to require a lot of rewriting of all my basic code to work.
  • Hi Anders,



    Generally, using Wait methods is a good practice. If you don't want to modify your code, tell us whether you can reproduce the same behavior with other web sites. If yes, can you send us a project demonstrating this (with logs)? You can attach it to the reply to the message you submitted regarding the same problem.

    Also, if we could access your page, this would help us investigate this problem more quickly.
  • AndersW's avatar
    AndersW
    Occasional Contributor
    Well after a busy period where I have not had time to look at this, I have decided to try and get my scripts to v8.00



    I am still having issues with this of course.



    Now what we have decided is that we somehow need to wait for the frame to finish loading, but I am unsure what to look for. Now I can make code for each time I need to wait, and then make it wait for a specific object for that page, but I would rather make a general function that works no matter which page I open, and no matter which objects are available on that page.



    At the bottom of the ie8 browser there is the usual load progress bar, that shows when the page is ready. Is this information stored in any of the properties of the frame object, or is it in the process or somewhere else??



    Does anyone have any "Best Practices" when testing in a browser?? ... some things to remember or good ideas??



    There are a few IE properties that might work: 'ReadyState' and 'Busy'. Can these be used to determine if the frame is done loading??



    Any help is greatly appreciated

  • Hi Anders,





    You can find several examples in the "Waiting For Page" help topic. I recommend that you try applying one of the solutions listed there.





    Does this help?