Working with QTP

TestEveryThing

Handle popup window QTP VB

Posted by rajivkumarnandvani on April 11, 2009

REM *************************************************************************
REM  Function  fn_GetPopupMessageText() This function Get the lable textmessage from Popup Dialog window  in Browser page
REM  and enter the label text in Result Excel Sheet
REM Note Dialog Window Must be child of  Parent object

REM  Input              := None
REM  Output(ReturnType) := None
REM  Created:    11/April/2009    Rajiv Kumar Nandvani ## Changed:MM/DD/YYYY

REM *************************************************************************

Call fn_GetPopupMessageText()
Public function fn_GetPopupMessageText()
Set objStaticText =Description.Create()
objStaticText(“nativeclass”).value =”Static”
objStaticText(“text”).value =”.*[a-z].*”
Set objWinbutton =Description.Create()
objWinbutton(“micclass”).value =”WinButton”
If Window(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=IEFrame”).Dialog(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=#32770″).Exist(2) then
Window(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=IEFrame”).Dialog(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=#32770″).Activate
set objStaticText = Window(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=IEFrame”).Dialog(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=#32770″).ChildObjects(objStaticText)
For i=0 to objStaticText.count-1
sDescription =objStaticText(i).GetVisibleText(-1,-1,-1,-1)
Next
set objWinbutton = Window(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=IEFrame”).Dialog(“regexpwndtitle:=Windows Internet Explorer”,”regexpwndclass:=#32770″).ChildObjects(objWinbutton)
For i=0 to objWinbutton.count-1
objWinbutton(i).click
Exit for
Next
fn_GetPopupMessageText = sDescription
End if
End Function

Public function fn_GetPopupMessageText()
Set objStaticText =Description.Create()
objStaticText(“nativeclass”).value =”Static”
objStaticText(“text”).value =”.*[a-z].*”
Set objWinbutton =Description.Create()
objWinbutton(“micclass”).value =”WinButton”
If Browser(“title:=.*(Page).*”).Dialog(“text:=Windows Internet Explorer”,”nativeclass:=#32770″).Exist(2) then
Browser(“title:=.*(Page).*”).Dialog(“text:=Windows Internet Explorer”,”nativeclass:=#32770″).Activate
set objStaticText = Browser(“title:=.*(Page).*”).Dialog(“text:=Windows Internet Explorer”,”nativeclass:=#32770″).ChildObjects(objStaticText)
For i=0 to objStaticText.count-1
sDescription =objStaticText(i).GetVisibleText(-1,-1,-1,-1)
Next
set objWinbutton = Browser(“title:=.*(Page).*”).Dialog(“text:=Windows Internet Explorer”,”nativeclass:=#32770″).ChildObjects(objWinbutton)
For i=0 to objWinbutton.count-1
objWinbutton(i).click
Exit for
Next

fn_GetPopupMessageText = sDescription
End if

End Function

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>