Forum Discussion

kikaider69's avatar
kikaider69
Occasional Contributor
14 years ago

I would like to check if a property inner text exists or not

   login_name = "Logged in as soki1"

   set Login_object =Aliases.iexplore.OrderHistory.panelHeader.panelHeaderWrapper.panelAuthorize.textnodeFirst

   Call aqObject.CheckProperty(Login_object, "innerText", cmpEqual, login_name)



I am basically creating scripts to do various things using ie9.



when I am logged in as soki1, it can find the login image object.

i can also create a simple if then statement to display a log message when the object text "Logged in as soki1" exists.



What I would like to do using exists or something similar to basically state if i am not logged in as soki1, display a log message stating that I am not logged in as soki1!!



I have similar ids soki2, soki3, soki4... you get the idea.



when i log in as them i want the program to identify that I am not logged in as soki1, display the log message and keep going instead of failing staing the object does not exists



Hope that is enough info for you

1 Reply

  • Hi Steven,


    Try using the following code:




    login_name = "Logged in as soki1"

    set Login_object =Aliases.iexplore.OrderHistory.panelHeader.panelHeaderWrapper.panelAuthorize.textnodeFirst


    If Login_object.innerText = login_name Then

      Log.Message "Logged in as soki1"

    Else

      Log.Warning "Not logged in as soki1"

    End If


    Most likely, you have the Stop on error property enabled in your project (the Tools | Current Project Properties -> Playback group in the tree on the left). When this property is enabled, TestComplete stops the test run if an error message is posted to the test log. The aqObject.CheckProperty method posts an error message to the log if the comparison fails. So, a possible alternative to using the If Then statement is to disable the "Stop on error" project property.