Forum Discussion

shawn2005's avatar
shawn2005
New Member
10 years ago

Sometimes the code throw Unable to find VBObject error.

My code is:

 

function AllTechsRadioButtonIsClicked()
{
if (WebPMAppPage.browser.VBObject("frmSelect").Exists && WebPMAppPage.browser.VBObject("frmSelect").WndCaption == "Data Selection")
{
var frmSelect = WebPMAppPage.browser.VBObject("frmSelect");
if (!frmSelect.Focused)
frmSelect.SetFocus();

// Technicians Tab
frmSelect.VBObject("SelectTabs").ClickTab("Technicians");
frmSelect.VBObject("SelectFrame_2").VBObject("Frame1").VBObject("optTechs").ClickButton();
}
}

 

Sometimes the code will failed at the if condition,

But actually the frmSelect is already displayed and it is not stuck.

 

Any body know how to avoid Can't find VBObject issue?

 

Thanks

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    Try putting a short Delay right before the If where it fails.  Sometimes pages will load information in the background and be slow even though it looks active on the screen.  The Delay will slow the test down a little and let the page catch up.