QTP 自定义方法将IE最大化最小化
来源:互联网 发布:redis json排序 编辑:程序博客网 时间:2024/04/30 11:12
This article demonstrates a quick tip to activate, minimize or maximize browsers. Unlike a Standard Windows Window
object, Browser does not support theActivate
, Minimize
, Maximize
methods. Therefore, we can create our custom function and tie it with the Browser object using RegisterUserFunc
.
The only trick is to retrieve the Browser Handle and substitute the handle in the description of a Window object, and use the Window’s Activate method instead.
ACTIVATE BROWSER
Function BrowserActivate(Object) Dim hWnd hWnd = Object.GetROProperty("hwnd") On Error Resume Next Window("hwnd:=" & hWnd).Activate If Err.Number <> 0 Then Window("hwnd:=" & Browser("hwnd:=" & hWnd).Object.hWnd).Activate Err.Clear End If On Error Goto 0End Function RegisterUserFunc "Browser", "Activate", "BrowserActivate"
After registering the BrowserActivate
function with the Browser object as Activate
we can use it just like we would use it for a Window object:
Browser("title:=Relevant Codes.*").Activate
BrowserActivate
can be extended to maximize and minimize a browser window as well. The only extra statement to be included in the function would be the maximize and minimize methods of the window object.
MINIMIZE BROWSERS
Function BrowserMinimize(Object) Dim hWnd hWnd = Object.GetROProperty("hwnd") On Error Resume Next Window("hwnd:=" & hWnd).Activate If Err.Number <> 0 Then hWnd = Browser("hwnd:=" & hWnd).Object.hWnd Window("hwnd:=" & hWnd).Activate Err.Clear End If Window("hwnd:=" & hWnd).Minimize On Error Goto 0End Function RegisterUserFunc "Browser", "Minimize", "BrowserMinimize"
MAXIMIZE BROWSERS
Function BrowserMaximize(Object) Dim hWnd hWnd = Object.GetROProperty("hwnd") On Error Resume Next Window("hwnd:=" & hWnd).Activate If Err.Number <> 0 Then hWnd = Browser("hwnd:=" & hWnd).Object.hWnd Window("hwnd:=" & hWnd).Activate Err.Clear End If Window("hwnd:=" & hWnd).Maximize On Error Goto 0End Function RegisterUserFunc "Browser", "Maximize", "BrowserMaximize"
If you would like to use the above 3 methods through a single function or class, they can be coupled together through Execute
statements or through If-Then or Switch-Case blocks. Happy reading!
- QTP 自定义方法将IE最大化最小化
- QTP 自定义方法将IE最大化最小化
- QTP中Browser对象的方法补充:激活、最大化、最小化
- 最大化和最小化IE
- QTP之IE最大化
- 让IE窗口最小化最大化的快捷键
- ie浏览器实现最大化最小化功能
- JS控制IE窗口最小化和最大化
- 【QTP】最小化QTP运行的方法
- QTP测试时,应用程序或者网页的最大化最小化控制
- QTP测试时,应用程序或者网页的最大化最小化控制
- QTP 浏览器最大化、最小化,适用于IE6\7\8
- Extjs4自定义关闭,最大化,最小化按钮接听
- 最大化最小化自定义窗口的尺寸
- ubuntu 12.04 LTS将最小化最大化关闭按钮移动到右上角的方法
- WPF 去掉最大化最小化的方法
- 自实现最小化,最大化,关闭按钮方法
- ubuntu 将最大化,最小化,关闭按钮置于窗口右侧
- 剖析java中的String之__拼接
- 利用泛型类返回多个结果
- 《女朋友 男朋友》 人生无别离 谁知恩爱重 请让我静静躺下,听着通往自由的道路在哪里
- POJ 1426 广搜BFS
- POJ 1065 贪心
- QTP 自定义方法将IE最大化最小化
- 深入理解Java虚拟机——程序编译与代码优化
- 符号文件——Windows 应用程序调试必备
- HDU 1856 简单并查集
- DVD机读碟故障维修技巧
- OpenCore介绍
- RCU机制(转)
- 十六进制字符串转换为十六进制数字
- va_list函数族应用