In the qtp test, where a bug occurs, we want to leave evidence, but sometimes the webpage is not maximized, so that we can capture irrelevant images. Here we provide some methods, this phenomenon can be avoided as much as possible.
- Yes
Use the built-in functions of qtp, such
Only page captures, excluding the preceding tools and navigation bar
Browser (" シテ"). Page (" ステ"). capturebitmap ("D:/1.bmp)
Entire Browser
Browser (" シテム). capturebitmap (" D:/1.bmp)
This is just a screen and cannot be captured to the whole page.
So sometimes we can also use some open-source tools, which is better.
- Synchronize before. For pages
Browser (" シテ"). Page (" ステ"). sync
- Maximize before.
Application operations:
Winobject. Maximize --- maximize
Winobject. Minimize --- minimize
Winobject. Restore --- return the size of the dish
Browser operations:
Winobject. fullscreen --- maximize the effect as F11
Winobject. Minimize --- minimize
- For the maximization of web pages, we will take a deeper look. winobject. fullscreen has the same effect as F11. It is not what we usually use to maximize. Sometimes we need to standardize it. What should we do if we need to use the general maximization?
In fact, browser (IE) is also an application for the operating system. We can achieve "general maximization" dim hwnd in disguise.
Hwnd = browser ("Browser"). getroproperty ("hwnd ")
'Msgbox CSTR (hwnd)
'Maximize the browser
Window ("hwnd: =" & hwnd). Maximize
Browser ("Browser"). navigate "http://www.google.com /"
'Reply to the size of the browser just now
Window ("hwnd: =" & hwnd). Restore
'Minimize the browser
Window ("hwnd: =" & hwnd). Minimize
In this way, we flexibly implement the maximization of IE and minimize it. Our colleagues can also restore it to the original size.