Friday, 10 May 2013

#4. RegisterUserFunc - How to Register a function?

#4. RegisterUserFunc - To add or change the behaviour of an existing test object method during a run session.
FUNCTION BrowserActivate(OBJECT)
   DIM hWnd
   hWnd = OBJECT.GetROProperty("hwnd") 'hwnd is a Windows Handle
   ON ERROR RESUME NEXT
   Window("hwnd:=" & hWnd).Activate
   IF ERR.NUMBER <> 0 THEN
     Window("hwnd:=" & Browser("hwnd:=" & hWnd).OBJECT.hWnd).Activate
     ERR.CLEAR
   END IF
   ON ERROR GOTO 0
END FUNCTION
RegisterUserFunc "Browser", "Activate", "BrowserActivate"
Browser("micClass:=Browser","index:=0").Activate
- BrowserActivate Function would be used to create Activate method for the Browser class.

No comments:

Post a Comment