Maximum and minimum control of applications or webpages during qtp Testing

Source: Internet
Author: User

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.

  1. 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.
  2. Synchronize before. For pages
    Browser (" シテ"). Page (" ステ"). sync
  3. 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
  4. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.