Forum Discussion

Raj_Qa's avatar
Raj_Qa
Contributor
13 years ago

Object browser giving different results for the same object

I write my script on the local and when I used the object browser it displays the name of the object as  name: Item("actionLink")

I run this script on a VM, and when I use the object browser for the same object this is what it shows  name:Button("ACTIONS")

and I cannot access this object on the VM, even though its the same object, I tried to use the class, name, id, inenrtext: gives me an unspecified error.



this is the fullname of the object in the object browser



Sys.Process("firefox").UIAObject("Automated_Processes_Mozilla_Firefox").Application("Automated Processes - Mozilla Firefox").PropertyPage(0).Grouping(0).PropertyPage(0).Panel(0).Document("Automated Processes").Panel(0).Panel(1).Panel(1).Button("ACTIONS")



Is there a reason for this inconsistency ?

I am using 8.7 with FF 8

4 Replies

  • ArtemS's avatar
    ArtemS
    SmartBear Alumni (Retired)

    Hello Raj,

    Most likely, the object names are dissimilar, because different web tree models are chosen on the local and virtual machines. The Item("actionLink") is the name notation used in the "Tag" and  "DOM" models, while the Button("ACTIONS") notation is applied in the "Tree" model.

    Please check the "Tree model"  and "Identification attribute" project settings on both of the machines and ensure their values are the same.





    The complete list of settings that affect the name notations can be found in the Settings That Affect the Object Browser Display topic.





    Happy testing.
  •   'click on the finish button

          set fbutton= all.item("TC_FinishAction")

          fbutton.click

          'clickon the actions button

                Set page = Sys.Process("firefox").Page("*")

          page.wait

        set all=page.document.all

      delayfunction(1500)

         set obj=page.nativewebobject.find("class","button TC_ActionButton")

         obj.click





    I have a script that clicks on the finish button and then tries to click the actions button shown in the picture. No matter what i try to use(class, id....) Testcomplete does not find the object.

    The source code shows the class, id of the actions button but the object browser shows something different.

    i have the default, current project property set to DOM model.

    I dont understand whats happening here but TC errors out and cannot click on the Actions button.

    I really need some help here.

  • Hello Raj,





    Try specifying the Page object more precisely and provide some wait time for refreshing the Sys tree after the TC_FinishAction click:



    ...

      'click on the finish button

          Set fbutton= all.item("TC_FinishAction")

          fbutton.click

          ' wait for the page to load

          Sys.Refresh()

         Set page = Sys.Process("firefox").WaitPage("*AutomatedProcesses*", 1500)

         Set ActionsBtn = page.NativeWebObject.Find("class","button TC_ActionButton")

         ' checks if the button exists

          If MyBtn.Exists Then

         ' click on the actions button      

         MyBtn.Click

    ...







    Besides, I'd recommend disabling the UI Automation for the Page objects, if this is not crucial for your test purposes.