Unable to verify object ''{0}'' is present

I have a problem, that sometimes when im running my test suite there is an error “Unable to verify object ‘’{0}’’ is present”.

The test cases looks like this:

  1. startApplication
  2. waitForElementPresent (findWindowsObject(‘Object Repository/mainWindow/loginWindow/tbUser’), 120)
  3. setText for login and password
  4. click Login button
  5. delay(15)
  6. switchToDesktop()
  7. waitForElementPreset(findWindowsObject(‘Object Repository/mainWindow/mainFrame’)), 120)
  8. Windows.switchToWindow(findWindowsObject(‘Object Repository/mainWindow/mainFrame’))
  9. do some stuff

After switching from Desktop to mainFrame the error occurs.

The object mainFrame is located by “//Window[contains(@Name, ‘MAINPRG’)]” by locator strategy “XPATH”:

The log: log.txt (20.0 KB)

Why does the error occurs? How to avoid it?

Anyone with problem like this?