Micro Focus QTP (UFT) Forums
.Sync is NOT waiting for browser to complete current navigation.. can anyone help? - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: .Sync is NOT waiting for browser to complete current navigation.. can anyone help? (/Thread-Sync-is-NOT-waiting-for-browser-to-complete-current-navigation-can-anyone-help)



.Sync is NOT waiting for browser to complete current navigation.. can anyone help? - mansis - 09-04-2012

For below script, I was using wait (3) to view the operations mentioned in script.. But due to wait command, I need to face 3 secs unnecessary delay..

I though .Sync can solve my purpose of waiting to complete current navigation and then only moving ahead.. But when I use .Sync in below script, It is not waiting to load the mentioned page and it goes ahead, which is wrong. Please review below script.

----------------

Code:
DataTable.Import("D:\Book1.xls")

For i=1 to Datatable.GetRowCount
DataTable.SetCurrentRow i
SystemUtil.Run DataTable("URL",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtUsername").Set DataTable("Username",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set DataTable("Password",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click
Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlUsers").Select DataTable("User",dtGlobalSheet)

'Select facility'
If Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Exist Then
    Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click
    Wait (2)
Else
    Reporter.ReportEvent micPass, "Login page", "Facility not exist"
    Wait (2)
End If

'Access Scheduler
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Click
[color=#FF0000]Browser("InSync :: Login").Page("InSync :: Visit Scheduler").Sync[/color]

'Access Patient Search
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image3").Click
Browser("InSync :: Login").Page("InSync :: Patient Search").Image("Edit Patient").Click

--------------

Here with above script, though step of scheduler accessing is NOT yet started / completed, next step of accessing patient search is started.. I was expecting that .Sync will help me to load scheduler page first.


Can anyone please let me know that what is wrong here.

If .Sync can solve my problem then I want to replace it with Wait to avoid unnecessary delay.


Sync is NOT waiting for browser to complete current navigation.. can anyone help? - mansis - 09-05-2012

Please help me urgently...


RE: .Sync is NOT waiting for browser to complete current navigation.. - freeboynil - 09-10-2012

Hi,
if wait will not solve...use

Code:
do
wait(3)
loop while Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image3").exists(3)



Alternative to Sync - DallasT - 09-11-2012

You could also do a loop such as...

Code:
Do while Browser(YourBrowser).Object.Busy = True
    Wait 0, 250
Loop



RE: .Sync is NOT waiting for browser to complete.. help me pls.. - mansis - 09-14-2012

Hi,

Error occurs while I am using your code of loop..Please referr attachment.

Below is the script--

---------------

Code:
URL = Datatable.Value("URL",Global)
User_name = Datatable.Value("User_name",Global)
Password = Datatable.Value("Password",Global)
Users = Datatable.Value("Users",Global)

systemutil.Run URL,1
'Wait (15)
Do while Browser("InSync :: Login").Object.Busy = True
    Wait (5)
Loop


Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set Password
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click

Do while Browser("InSync :: Login").Object.Busy = True
    Wait (5)
Loop

Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlUsers").Select Users
Wait (8)
'Select Facility
If  Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Exist Then
    Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click
    Wait (4)
End If
'Wait (20)


Browser("InSync :: Login").Close
------------------

Please help me to resolve this error.

Thanks,
Mansi.