Micro Focus QTP (UFT) Forums
QTP not clicking on Yes button in the IE pop up dialog - 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: QTP not clicking on Yes button in the IE pop up dialog (/Thread-QTP-not-clicking-on-Yes-button-in-the-IE-pop-up-dialog)



QTP not clicking on Yes button in the IE pop up dialog - adityasrinivasb - 09-12-2013

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

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
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


RE: QTP not clicking on Yes button in the IE pop up dialog - SweetyChowdhury - 09-13-2013

Try this code below:

Code:
IF Browser("Mybrowser").Dialog("Internet Explorer").Exist(0) Then
Browser("Mybrowser").Dialog("Internet Explorer").WinButton("Yes").Activate
Browser("Mybrowser").Dialog("Internet Explorer").WinButton("Yes").Click
End If

Insert the reporter statements accordingly. The code first checks the dialog box exists and then activates the 'Yes' button.


RE: QTP not clicking on Yes button in the IE pop up dialog - prashantrawat101@gmail.com - 09-29-2013

In Descriptive programming,Use the micclass property to select the yes button by specifying its ordinal identifier(index).