UIAutomation Learning Primer

Source: Internet
Author: User

A . automated operation of the interface

. Ui Automation Testing

. Software plug -in

Two . Win32 Basic Knowledge

all elements in A.win32 are windows, and there is a parent-child relationship between windows. The entire desktop is a "root window".

B. process:

Get the process object based on the process id processes = Process.getprocessbyid (processId);

Start a process: process process= Process.Start (exe path );

Kills a process . Kill ()

Three . Uiautonation Foundation

1, need to add to uiautomationclient, uiautomationprovider, references to uiautomationtypes

2,automationelement.rootelement is the window root element

Automationelement.fromhandle (INTPTR hwnd) gets the AutomationElement object from the window handle .

3. Traverse:

Mainelement.findall (Treescope.descendants,

New PropertyCondition (Automationelement.classnameproperty, "Tlabelededit"));

The Treescope.descendants represents recursion from all descendant elements recursively, and if it is found from a direct child node, the Treescope.children is used .

Condition is a filter condition that can be looked up based on the class name, or if the query condition is not specified, use condition.true Condition.

FindFirst was the first one to find out.

4, click the button, set the text, read the text using Pattern to achieve. Not all Pattern Support

1) Set the value of the control

ValuePattern

ValuePattern = (ValuePattern) element. Getcurrentpattern (Valuepattern.pattern);

Valuepattern.setvalue ("rupeng.com");

2) Get the value of the text control

TextPattern

ValuePattern = (TextPattern) element. Getcurrentpattern (Textpattern.pattern);

String v= ValuePattern.DocumentRange.GetText (-1);

3) invoking the control, such as clicking the button

var Clickpattern = (Invokepattern) element. Getcurrentpattern (Invokepattern.pattern);

Clickpattern.invoke ();

UIAutomation Learning Primer

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.