09-12-2013, 04:13 PM
Hi
I am automating a web application using QTP 11. After the login operation, I get the IE pop up dialog titled -"Internet Explorer" and text inside it - "The page is accessing information that is not under its control. This poses a security risk. Do you want to continue" with a Yes and No button.
I automated it by adding the objects in the repository and writing script
But the above script some times fails to click the Yes button
I tried descriptive programming like this
I could not get the Yes button clicked with the above statement
At last I tried to handle it by using a function
But still no luck. The above function gets the handle to the title of the pop up - sPopTitle = oPopDlg.GetROProperty("title"), but never clicks the Yes button
Please suggest me something here
Regards
Srinivas
I am automating a web application using QTP 11. After the login operation, I get the IE pop up dialog titled -"Internet Explorer" and text inside it - "The page is accessing information that is not under its control. This poses a security risk. Do you want to continue" with a Yes and No button.
I automated it by adding the objects in the repository and writing script
Code:
Browser("Mybrowser").Dialog("Internet Explorer").WinButton("Yes").Click
But the above script some times fails to click the Yes button
I tried descriptive programming like this
Code:
Browser("title:="My Browser").Dialog("text:=Internet Explorer").Winbutton("text:=&Yes").Click
I could not get the Yes button clicked with the above statement
At last I tried to handle it by using a function
Code:
Set oBrw = Browser("title:="My Browser")
Call fnCleanBrowserPopups(oBrw)
Public Function fnCleanBrowserPopups(oBrw)
'Get the popup dialog
Set oPopDlg = oBrw.Dialog("ispopupwindow:=True")
fnCleanBrowserPopups = False
If oPopDlg.Exist(0) Then
'There is a popup dialog
'Get its title
sPopTitle = oPopDlg.GetROProperty("title")
Select Case LCase(sPopTitle)
Case "Internet Explorer"
oPopDlg.WinButton("text:=&Yes").Click
fnCleanBrowserPopups = True
Reporter.ReportEvent micPass, sPopTitle, "Closed IE dialog popup"
Case Else
Reporter.ReportEvent micFail, "Unknown dialog box - ", sPopTitle
End Select
End If
End Function
Please suggest me something here
Regards
Srinivas