Micro Focus QTP (UFT) Forums
QTP consuming more time while checking for the objects - 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: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: QTP consuming more time while checking for the objects (/Thread-QTP-consuming-more-time-while-checking-for-the-objects)



QTP consuming more time while checking for the objects - skadam - 09-15-2011

Hi All,

In my script as the precondition we check for some objects in application, the pseudo code is like this:
Code:
Set objBrowser = Browser("x").Page("y")
With objBrowser
  If .[b]webelement("z").Exist [/b]Then
     msgbox "Pass"
  else
     msgbox "Fail"
   end if
End With

If condition is taking some around 8-10 seconds, which is not expected and unusual. After this condition, the rest of the script executes fast. It happens almost in every script which is affecting the performance of execution. I am not able to find any clue why its taking so much of time just for checking the webelement as the first step in script.

Can anyone please help me out here.

Thanks in adv,
Sravanthi


RE: QTP consuming more time while checking for the objects - SailajaKavi - 09-15-2011

can you tell ,if teh webelement you are checking is present in the screeen or not .with these kind of statements ,generally i feel if it doesnot get that element immediatly , it waits certain time and then proceeds to next step.

put a sync point before teh if statement this will remove any chances of
page loading delay of that statement.


RE: QTP consuming more time while checking for the objects - vIns - 09-15-2011

Hi Sravanthi,
Plz use as given below.
Browser().Page().Webelement().Exist(1) ' it will wait for a sec and return true or false based on the objects availability.



RE: QTP consuming more time while checking for the objects - skadam - 09-16-2011

Hi Sailaja,

Thanks for the reply. The webelement exists in appln when the test case executes if condition. Yes I will check by using .sync before condition.

Thanks,
Sravanthi

@ vIns

Thanks for the reply. I will use .Exist(1) and check the performance. But as the required object exists in appln, i assume that qtp should not consume more time to identify. Will update you after modfiication.

Thanks,
Sravanthi


RE: QTP consuming more time while checking for the objects - skadam - 10-04-2011

Hi,

I have used both .Sync and .Exist(1) approaches. But no siginificant improvement in performance. Anyone please help.

THanks,
Sravanthi