Forum Discussion

dAniel_rj's avatar
dAniel_rj
Occasional Contributor
14 years ago

Waiting for a Item to make a click on it

Hi everyone!



I have a radmenu (telerik), and when i record my test, testcomplete records this:

w4 := w3.Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo');

w4.DropDown;

w4.ClickItem('Agendado');



However, some times the itens of the list load slowly, and testcomplete try to make a click in the object that not's visible yet.

So i checked the object of one item in this list, and try to make the testcomplete wait until this object stay visible. I did this:
w4 := w3.Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo');

w4.DropDown;

if  w2.Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo_DropDown').Panel(0).WaitTextNode(1,1000).visible then



w4.ClickItem('Agendado');


I don't know what is happens, but testcomplete not recognize the rad menu as visible. I try allready exists, visibleonscreean, enabled.. nothing work.. i try this too... but don't work ...

w4 := w3.Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo');

w4.DropDown;

if  w4.WaitItem('Agendado',1000).exists then



w4.ClickItem('Agendado');


Any idea of what i'm doing wrong?
  • dAniel_rj's avatar
    dAniel_rj
    Occasional Contributor
    I tried this command and works (apparently):





    w4:= w2.Find('innertext','Agendado',1000);

    if w4.exists then

      w4.Click;





    What do you guys think?
  • dAniel_rj's avatar
    dAniel_rj
    Occasional Contributor
    Me again... now i tried this one:






    w4.DropDown;

    NameMapping.StatusCurriculum.RefreshMappingInfo;

    If NameMapping.StatusCurriculum.Exists then

    w4.ClickItem('Agendado');





    In Mapped Objects i have the name of the object that i captured with the Finder Tool...

    However... once more, i can't define that the object exists before to make the click on it...
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Try using WaitNamedChild to off of the NameMapping node to wait for the component to be avialable before clicking on it.
  • dAniel_rj's avatar
    dAniel_rj
    Occasional Contributor
    Hi Robert, 



    I tried using WaitNamedChild, but doesn't work (or i do not used it well)..

    I noticed something: when i record a test using Record Script, testcomplete returns this:






    procedure Test2;

      var p : OleVariant;

      var w : OleVariant;

    begin

      p := Sys.Process('iexplore', 2);

      w := p.Page('http://nt09:8080/').Frame(0).Form('aspnetForm').Panel(4).Table('ctl00_HeaderTable').Cell(0, 0).Panel(0).Table(0).Cell(1, 0).Table(0).Cell(0, 1).Table(0).Cell(4, 0).Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_MPCurriculum').Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_PvConsulta').Table(0).Cell(1, 0).Table(0).Cell(4, 0).Table(0).Cell(1, 0).Panel('ctl00_ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculoPanel').Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo');

      w.DropDown;

      w.ClickItem('Reagendar');

    end;




    Now, look the path of the object, if i use the Find Tool:






    procedure Test3;

      var p : OleVariant;

      var w : OleVariant;  

    begin

      p := Sys.Process('iexplore', 2).Page('http://nt09:8080/').Frame(0).Form('aspnetForm'); 

      w := p.Panel(0).Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo_DropDown').Panel(0).TextNode(1);

      if w.visible then

        w.Click;

    end;





    In the record the path is different of the path found using Find Tools.

    I guess that the list of itens of this menu, is a object that not belong to the selection's box.. let me try explain: 

    I have the selection box, with a path Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_MPCurriculum').Panel(0), and i have the list itens in this path Panel('ctl00_ContentPlaceHolder1_ConsultaCurriculo1_RcbStatusCurriculo_DropDown').Panel(0), (differents paths). When i click on the selection box, the page loads the itens from the list, creating a temporary path that only exists in the moment of the click. I don't know if this make any sense, but when i use the NameMapping, in a first place the Highlight can show the object in the page, but, in a second moment, the testcomplete can't find it anymore...

    I'm starting to think that put a delay between the dropdown and the click will be the only thing that will work to me... :/
  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hi Danie,



    Please pack the folder containing your project suite along with problematic execution logs and post the archive - most probably, if we can analyze it, we'll be able to give you more specific advice. Or, can you give us access to your site and point out the problematic elements? If we have it, we'll try to create a sample for you.



    Please note that if you need personalized assistance, you can submit an individual support case via our Contact Support form.