Use AutoIt to implement automatic login/exit client software, delete log _autoit

Source: Internet
Author: User
After developing the client that provided the added log version, start trying to reproduce the error. Manually logged in more than 20, again encountered login failed, but development said the output log is not detailed enough to resubmit a compiled version. Really do not want to repeat the login operation, so think of writing an automated script to achieve the manual process:

1 Enter user name, password, login client

2) Exit the client

3 Delete the installed User application directory (after each user login, will generate a user's application directory, delete is to try to close to the new installation of the client and then log in)

The first thought is QTP, but because my test machine before the installation QTP not successful, reload system of course is too late. So the idea of using AutoIt to complete the above requirements, the code is simple, as follows:

Run ("D:\ installation directory \xxx.exe")

; Sleeping sleep (milliseconds), this is to wait for the user to log in to the dialog box appears

Sleep (2000)

; dialog box waiting for client to log on

Winwait ("Login box window name")

; Enter a user ID in the user box by: controlsend (Window caption, window text, control ID, string [, Flag])

Controlsend ("Login box window name", "" "," Edit6 "," username ")

; Enter a password in the Password box

Controlsend ("Login box window name", "" "," Edit7 "," passwd ")

; Click on the "Login" button, Method: Controlclick ("window title", "Window text", control ID [, button [, click Times [, x coordinates [,; Y-coordinate]]]

Controlclick ("Login box window name", "", "Button6")

; Wait 5 seconds

Sleep (5000)

, waiting for the client window to appear when the login is successful

Winwait ("client window name after successful login")

Sleep (5000)

Winclose ("client window name after successful login")

To delete user application stencil paths generated after logon

DirRemove ("C:\ User application Directory", 1)

With this script, we can reproduce or verify that the defect is fixed by specifying the number of logins. Finally, the 11th modified version of the development, the repeated run login 50 times, no login failed, indicating that the defect was repaired. If the use of manual testing, 11 versions of the test down hand estimate will be broken, hehe.

AutoIt provides a window information tool to identify a window or control, which is simple enough to refer to the Help manual for AutoIt.

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.