Forum Discussion

fbordalo's avatar
fbordalo
Occasional Contributor
6 years ago

Object browser not available in the given context

Hi,

 

After killing TC, my script now fails in a step that previously worked. The capture window at this point shows my object active on the screen.

 

Thanks

Fred

 

Here is the code:

Function AlarmsFilterPopUpDialogs()

'Open the browser
Browsers.Item(ProjectSuite.Variables.Browser).Run(ProjectSuite.Variables.SitePortalUrl)
Sys.Browser().BrowserWindow(0).Maximize

'Get the containers for the page
Set objMainHTML = Aliases.browser.pageSitePortal.objectMain
Set objMainFlex = objMainHTML.mainFlex

'Log into the system
Set objUserLoginPanel = objMainFlex.userLoginPanel
Set btnLogIn = objUserLoginPanel.WaitAliasChild("linkbuttonLogIn", 10000)
objUserLoginPanel.textboxUsername.click
objUserLoginPanel.textboxUsername.Keys(ProjectSuite.Variables.UserName)
objUserLoginPanel.textboxPassword.click
objUserLoginPanel.textboxPassword.Keys(ProjectSuite.Variables.Password)
btnLogIn.Click

'At this point, the object browser show "Object browser not available in this context"

'Handle the welcome panel
Set objDialog = objMainHTML.WaitChild("bulletindialogBulletin", 60000)
'Set btnClose = objMainHTML.bulletindialogBulletin.WaitChild("linkbuttonCancel", 30000)
'btnClose.Click
objDialog.linkbuttonCancel.click

'Click the Home button
set btnHome = objMainFlex.WaitAliasChild("linkbuttonHome",60000)
objMainHTML.listbuttonAlarms.Click

'Bring up the alarms canvas
set btnHome = objMainFlex.canvasHome.canvasInfo.WaitAliasChild("buttonAlarmFilterList", 60000)
btnHome.Click

'Wait for the alarm panel to display
set objAlarmTable = objMainFlex.canvasHome.canvasInfo.WaitAliasChild("panelAlarm",60000)
objMainFlex.canvasHome.canvasInfo.buttonAlarmscanvas.ClickButton


End Function

  • While code is running, Object Browser cannot be viewed.  This is part of the TestComplete environment.  So, even a sleep or wait or whatever is still running code.  A breakpoint should allow you to view the object browser, likewise a halt to the script. 

     

    So, we need to go back to your error itself.  You say the script halts after attempting the login step.  What error messages do you get in the TestComplete error log at that point? We need to start the investigation there.  

  • fbordalo's avatar
    fbordalo
    Occasional Contributor

    In debug mode, placed a break point at the btnLogIn.click, step to execute the click, and kill the script. Checking the object browser tree, I see wait or delay produces the message '...unavailabe.

     

    I changed the code to use a long sleep instead of waiting for the object and the script click worked. What is going on?

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      While code is running, Object Browser cannot be viewed.  This is part of the TestComplete environment.  So, even a sleep or wait or whatever is still running code.  A breakpoint should allow you to view the object browser, likewise a halt to the script. 

       

      So, we need to go back to your error itself.  You say the script halts after attempting the login step.  What error messages do you get in the TestComplete error log at that point? We need to start the investigation there.  

      • fbordalo's avatar
        fbordalo
        Occasional Contributor

        Problem was due to parent node was not mapping reliably. Thanks for the help.