Thursday, 22 January 2015

UFT - QTP- How to Maximize a Browser or Maximize Internet Explorer

 

Here is a simple code that could help
 
Set objPage = Browser("name:=Nameofbrowser").page("title:=titleofbrowser")

Call BrowserMaximize(objpage)

Function BrowserMaximize(byval ObjPage)
    On Error resume next
    If objpage.Exist Then
        width = objPage.Object.parentwindow.screen.width
        height = objPage.Object.parentwindow.screen.height
        objpage.Object.Parentwindow.moveto 0,0
        objpage.Object.Parentwindow.resizeto width,height
        Reporter.ReportEvent micPass,"BrowserMaximize","Browser maximized"
    else
        Reporter.ReportEvent micFail,"BrowserMaximize","Browser/Page object does not exist"
    End If
    Err.clear
End Function
 
Or

Some may be using the Object Repository for the same purpose

Browser().page().Maximize may be also used in that case
 
 
 

3 comments: