Forum Discussion

joffre's avatar
joffre
Regular Contributor
11 years ago
Solved

TestComplete 9.30 WebApp Testing

Hi all.



I'm trying to create a conditional that will verify if an object exists or not. However, on web applications, the web objects always exists in frame, but it's shown to the user on browser just when it is required.



How can I test if it is visible or not?



I already tried like this, but it didn't work:




if ((Sys.Browser().Page(Beneficios).Form("form1").Panel(3).Panel("pnlcapslock").Panel("divInconsistencia").Panel("divFecharInconsistencia")).Visible) {

 
Sys.Browser().Page(Beneficios).Form("form1").Panel(3).Panel("pnlcapslock").Panel("divInconsistencia").Panel("divFecharInconsistencia").Click();

 Log.Error("Object found");

} else {

 
Log.Message("Object didn't found. Proceed with tests.");

}


  • First you need to make sure that object exists. In your case you can use WaitPanel method.

    http://support.smartbear.com/viewarticle/28602/



    T
    his method returns an object and you can verify its Exists property. After this you can make sure that object is visible on screen. Something like this

    var obj = Sys.......WaitPanel(..., ...);

    if (obj.Exists && obj.VisibleOnScreen)

    {

      obj.Click();

    }



7 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    Just verify VisibleOnScreen property instead of Visible, it should work
  • karkadil's avatar
    karkadil
    Valued Contributor
    First you need to make sure that object exists. In your case you can use WaitPanel method.

    http://support.smartbear.com/viewarticle/28602/



    T
    his method returns an object and you can verify its Exists property. After this you can make sure that object is visible on screen. Something like this

    var obj = Sys.......WaitPanel(..., ...);

    if (obj.Exists && obj.VisibleOnScreen)

    {

      obj.Click();

    }



  • joffre's avatar
    joffre
    Regular Contributor
    Hello, thanks for your answer.



    However it didn't work. The log is attached.



    Hope you can help me.



    Regards,

    Joffre Mota
  • joffre's avatar
    joffre
    Regular Contributor


    Sorry about the novice question, but I have no idea about how to use this 'Wait Methods'.



    Could you enlighten this for me please.



    Thanks for your support.


  • joffre's avatar
    joffre
    Regular Contributor
    It worked.



    I've tried here some options and it worked. Thanks!


    var obj = Sys.Browser().Page("http://vm-w7-web-dp1/Beneficios/logon.aspx").Form("form1").Panel(3).WaitPanel("pnlcapslock", 10);



    if (obj.Exists && obj.VisibleOnScreen) {

     
    obj.Click();

     
    Log.Error("Object found. Automation terminated until problem is corrected.");

     
    Sys.Browser().Terminate(); //not working yet

    } else {

     
    Log.Message("Object didn't found. Proceed with tests.");

    }


  • joffre's avatar
    joffre
    Regular Contributor
    A new issue, my friend!



    When I'm recording, after I log in the app, Google Chrome looks like stopped working. So, I stop the TestComplete recording, and then Google Chrome works again.



    What can I do about that!?
  • karkadil's avatar
    karkadil
    Valued Contributor
    This is absolutely different problem and I'm afraid I will not be able to help you.



    I recommend creating a new topic for this issue.