码迷,mamicode.com
首页 > 其他好文 > 详细

QTP之IE最大化

时间:2015-05-13 21:43:11      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:


    ‘———————————————————————————————————————————
    ‘名称:MaxIE
    ‘作用:最大化IE
    ‘使用:QTP.MaxIE(BrowserCreationTime)
    Function MaxIE(BrowserCreationTime)
        On Error Resume Next  ‘开启错误处理,不弹出错误。
            If Cint(Browser("CreationTime:=" & BrowserCreationTime).GetROProperty("width")) > 1300 Then
                Exit Function
            End If
            
            Dim IEversion
            IEversion = Browser("CreationTime:=" & BrowserCreationTime).GetROProperty("application version")
            
            Select Case IEversion
                Case ""
                    msgbox"【警告】获取IE浏览器版本失败。"
                
                Case "internet explorer 6"
                    Dim BrowserHwnd
                    BrowserHwnd = Browser("CreationTime:=" & BrowserCreationTime).GetROProperty("hwnd")
                    window("hwnd:=" & BrowserHwnd).Maximize
                
                Case Else
                    If BrowserCreationTime = 0 Then 
                        Window("nativeclass:=IEFrame","index:=" & BrowserCreationTime).Maximize
                        wait 1
                    Else
                        Browser("CreationTime:=" & BrowserCreationTime).FullScreen
                        wait 1
                    End If
                    
            End Select
            
        If Err.number <> 0  Then
            magbox"【警告】最大化IE浏览器失败。Err.description = " & Err.description
            Err.Clear
        End If
        On Error Goto 0                 ‘关闭错误处理,弹出错误。
    End Function

QTP之IE最大化

标签:

原文地址:http://www.cnblogs.com/marcello/p/4501551.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!