Use autoit to automatically log on to/out of the client and delete logs

Source: Internet
Author: User

After developing a client that provides a log version, start to try to reproduce the error. After manual logon for more than 20 times, the logon failed again, but the Development said that the output logs were not detailed enough and a new compilation version was submitted. I really don't want to repeat the login operation, so I thought of writing an automated script to implement the manual process:

1) enter the user name and password to log on to the client.

2) log out of the Client

3) Delete the user application directory after installation (a user application directory is generated every time the user logs on. The delete directory is to be as close as possible to logon after the new client is installed)

The first thing that comes to mind is qtp. But since qtp was not successfully installed on my test machine, it is too late to reinstall the system. So I want to use autoit to meet the above requirements,CodeIt is very simple, as follows:

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

Sleep (MS), to wait for the user to log on to the dialog box

Sleep (2000)

; Waiting for Client Login Dialog Box

Winwait ("Logon window name ")

In the "user" box, enter the user ID by using controlsend ("window title", "window text", Control ID, "string" [, Flag]).

Controlsend ("Logon window name", "", "edit6", "username ")

Enter the password in the "password" box.

Controlsend ("Logon window name", "", "edit7", "passwd ")

Click the "Log on" button. The method is controlclick ("window title", "window text", Control ID [, key [, number of clicks [, X coordinate [,; Y coordinates])

Controlclick ("Logon window name", "", "button6 ")

; Wait 5 seconds

Sleep (5000)

The client window appears after the login is successful.

Winwait ("client window name after Successful Logon ")

Sleep (5000)

Winclose ("client window name after Successful Logon ")

Delete the user application mold path generated after login

Dirremove ("C: \ User application directory", 1)

With this script, we can reproduce or verify whether the defect is fixed by specifying the number of logins. Finally, for the 11th modified version after development, the system repeatedly runs and logs on for 50 times. No Logon failure occurs, indicating that the vulnerability has been fixed. If a manual test is used, the 11 versions will be disconnected after testing.

Autoit provides a window information tool to identify windows or controls. It is easy to use. For more information, see the help manual provided by autoit.

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.