Passing Object to Function - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Passing Object to Function (/Thread-Passing-Object-to-Function) |
Passing Object to Function - Mozza - 07-30-2018 I need to pass an object to a function and wait until it no longer exists - as it is not saved until the popup has disappeared. I need to set a time out for the popup displaying to stop looking after a certain time This is required on many different panels / popup, so I want the same code to work just based on a same browser, different page, different heading on popup I have tried the following but it does not reset the .exist line, so the value never changes to false Code: Function waitToBeSaved(strObject) – being Browser(BrowserName).Page(PageName). object (popup header) This works fine outside of the function Do I need to Set the object?? RE: Passing Object to Function - Mozza - 07-31-2018 This solution is working - worked it out myself. Code: 'Wait for save to finish RE: Passing Object to Function - Mozza - 08-02-2018 Just in case anyone is looking - this also works This is waiting for the object to appear and waits till it does, or drops out if it doesn't appear after a certain time Function WaitForResult(theObj) timeSpent = 0 waitTimeOut = 20 Set tempObj = theObj 'example: Browser("PD").Page("SearchPage").WebTable("Results Table") Do While tempObj.Exist(0) = False If timespent = waitTimeOut Then Reporter.ReportEvent micFail, "Wait for Result", "Waiting for a result to occur and has not appeared in " & timeSpent & " seconds. Need to check why it has not saved. Test will stop" ExitTest Else Wait 1 timeSpent = timeSpent + 1 End If Loop End Function |