Skip to content

Commit 3166346

Browse files
committed
FIX(General cleanup of code, check style and fixing issues with the interfaces)
1 parent 6453ee5 commit 3166346

File tree

195 files changed

+2249
-1745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+2249
-1745
lines changed

docs/caching.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ There is limited support for caching, enough to demonstrate the functionality th
55
The following code example shows a function that retrieves items from a window and caches the Selection pattern and Name property for each item.
66
By default, the list items are returned with a full reference, so that all current properties are still available.
77
```
8-
AutomationWindow window = automation.getDesktopWindow("Form1");
8+
Window window = automation.getDesktopWindow("Form1");
99
1010
PointerByReference condition = automation.createTrueCondition();
1111

docs/calendar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The Calendar control supports the Grid, Scroll, Table, Value and Selection patterns.
22

33
```
4-
AutomationCalendar calendar = applicationWindow.getCalendar(Search.getBuilder(0).build());
4+
Calendar calendar = applicationWindow.getCalendar(Search.getBuilder(0).build());
55
logger.info("Date is " + calendar.name());
66
```

docs/checkbox.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* See [Element Discovery](element-discovery.md)
33

44
```
5-
AutomationCheckBox check = window.getCheckBox(Search.getBuilder(0).build());
5+
CheckBox check = window.getCheckBox(Search.getBuilder(0).build());
66
check.toggle();
77
88
try {

docs/combobox.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* See [Element Discovery](element-discovery.md)
33

44
```
5-
AutomationComboBox cb1 = window.getCombobox(Search.getBuilder("AutomatedCombobox1").build());
5+
ComboBox cb1 = window.getCombobox(Search.getBuilder("AutomatedCombobox1").build());
66
String oldTxt = cb1.text();
77
cb1.setText("Replacements");
88
String txt = cb1.text();

docs/developer.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In order to get access to the automation API, an UIAutomation instance needs to
5353

5454
### Launching an application
5555

56-
The AutomationApplication class provides functionality to start and attach to an application. There are 3 class methods provided to do this.
56+
The Application class provides functionality to start and attach to an application. There are 3 class methods provided to do this.
5757

5858
* Launch - this will launch the application supplied, and pass in any supplied arguments
5959
* Attach - this will attach to an already launched application, based on the executable name
@@ -63,8 +63,8 @@ The snippet below will check whether Project1.exe is running, attaching to it if
6363

6464
```
6565
// Build the application details up, ready for launching
66-
AutomationApplication application =
67-
new AutomationApplication(
66+
Application application =
67+
new Application(
6868
new ElementBuilder()
6969
.automation(automation)
7070
.applicationPath("apps\\Project1.exe"));
@@ -85,7 +85,7 @@ The root element of the tree of automation elements is the user’s desktop.
8585
To get a 'desktop' window (i.e. one that appears in the Windows tasks bar), then the AutomationDesktop class provides a class function that returns a AutomationWindow object.
8686

8787
```
88-
AutomationWindow window = automation.getDesktopWindow("Form1");
88+
Window window = automation.getDesktopWindow("Form1");
8989
window.focus();
9090
```
9191

@@ -96,7 +96,7 @@ This will find (if it is there) a window that has the given title, and set focus
9696
Each control contained in a container (such as a window or panel) can be identified by the index of that control, sometimes (this depends on the control type), by the text associated with it, OR by the Automation Id. For example, in order to get the textbox associated with the connection window (and assuming that it is the 1st Edit box on the window), the following code will find the editbox, and change the text to be USER1.
9797

9898
```
99-
AutomationEditBox user = window.getEditBox(Search.getBuilder(0).build());
99+
EditBox user = window.getEditBox(Search.getBuilder(0).build());
100100
user.setText("USER1");
101101
```
102102

@@ -106,26 +106,27 @@ In order to click the 'OK' button associated with a given window, it can be foun
106106

107107
```
108108
// Get button by index
109-
AutomationButton button1 = window.getButton(Search.getBuilder(0).build());
109+
Button button1 = window.getButton(Search.getBuilder(0).build());
110110
button1.click();
111111
```
112112

113113
```
114114
// Get button by name
115-
AutomationButton button1 = window.getButton(Search.getBuilder("OK").build());
115+
Button button1 = window.getButton(Search.getBuilder("OK").build());
116116
button1.click();
117117
```
118118

119119
```
120120
// Get button by automation id
121-
AutomationButton button1 = window.getButton(Search.getBuilder().automationId("btnOK").build());
121+
Button button1 = window.getButton(Search.getBuilder().automationId("btnOK").build());
122122
button1.click();
123123
```
124124

125125
# Current supported controls
126126

127127
The controls that have been implemented reflect the requirements for automating the applications that we are testing ourselves, so some controls have not been implemented, or only partially. The currently supported controls are ...
128128

129+
* [Application](application.md)
129130
* [Button](button.md)
130131
* [Grids](grids.md)
131132
* [Ribbon](ribbon.md)

docs/document.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* See [Element Discovery](element-discovery.md)
33

44
```
5-
AutomationDocument document = applicationWindow.getDocument(Search.getBuilder(0).build());
5+
Document document = applicationWindow.getDocument(Search.getBuilder(0).build());
66
77
logger.info("Document name is `" + document.name() + "`");
88
logger.info("Text is " + document.getText());

docs/element-discovery.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Note that the automation id is an 'extra' search criteria, and has to be 'chaine
3535

3636
```
3737
// Get button by automation id
38-
AutomationButton button1 = window.getButtonSearch.getBuilder().automationId("AutomatedCombobox1").build());
38+
Button button1 = window.getButtonSearch.getBuilder().automationId("AutomatedCombobox1").build());
3939
button1.click();
4040
```
4141

@@ -47,7 +47,7 @@ The example shows a button being located by it's index. This will be the first b
4747

4848
```
4949
// Get button by index
50-
AutomationButton button1 = window.getButton(Search.getBuilder(0).build());
50+
Button button1 = window.getButton(Search.getBuilder(0).build());
5151
button1.click();
5252
```
5353

@@ -58,29 +58,29 @@ Each element also has a more specific find API, allowing specific functions to f
5858
## Index
5959
```
6060
// Get button by index
61-
AutomationButton button1 = window.getButton(0);
61+
Button button1 = window.getButton(0);
6262
button1.click();
6363
```
6464

6565
## Name
6666
```
6767
// Get button by name
68-
AutomationButton button1 = window.getButton("Button1");
68+
Button button1 = window.getButton("Button1");
6969
button1.click();
7070
```
7171

7272
## AutomationId
7373
```
7474
// Get button by automationId
75-
AutomationButton button1 = window.getButtonByAutomationId("ButtonId");
75+
Button button1 = window.getButtonByAutomationId("ButtonId");
7676
button1.click();
7777
```
7878

7979
## Regex pattern
8080

8181
```
8282
// Get button by regex pattern
83-
AutomationButton button1 = window.getButton(Pattern.compile("myN.*"));
83+
Button button1 = window.getButton(Pattern.compile("myN.*"));
8484
button1.click();
8585
```
8686

docs/excel.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
Assuming that the application has already been started, the following code shows how to get data out of cells.
22

33
```
4-
AutomationWindow window = application.getWindow("Book1 - Excel");
5-
logger.info(window.name());
4+
Window window = application.getWindow("Book1 - Excel");
5+
logger.info(window.name());
66
7-
AutomationPanel panelX = window.getPanelByClassName(0, "XLDESK");
8-
logger.info(panelX.name());
9-
logger.info(panelX.getClassName());
7+
Panel panelX = window.getPanelByClassName(0, "XLDESK");
8+
logger.info(panelX.name());
9+
logger.info(panelX.getClassName());
1010
11-
AutomationTab tab = panelX.getTab(Search.getBuilder(0).build());
12-
logger.info(tab.name());
13-
AutomationDataGrid grid = tab.getDataGrid(Search.getBuilder(0).build());
14-
logger.info(grid.name());
11+
Tab tab = panelX.getTab(Search.getBuilder(0).build());
12+
logger.info(tab.name());
13+
DataGrid grid = tab.getDataGrid(Search.getBuilder(0).build());
14+
logger.info(grid.name());
1515
16-
// Get some data
17-
AutomationDataGridCell cell = grid.getItem(0,0);
18-
logger.info(cell.name());
19-
logger.info(cell.value());
16+
// Get some data
17+
DataGridCell cell = grid.getItem(0,0);
18+
logger.info(cell.name());
19+
logger.info(cell.value());
2020
```
2121

2222
NOTE: The call to getPanelByClassName is only available post release 0.3.10

docs/explorer.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
The Windows Explorer application has a complex user interface, and the examples below only show some of the possible interactions that are available.
22

33
```
4-
AutomationWindow window = automation.getDesktopWindow("File Explorer");
4+
Window window = automation.getDesktopWindow("File Explorer");
55
window.focus();
66
77
// Get the ribbon, work our way down and click the "Preview Button"
8-
AutomationRibbonBar ribbon = window.getRibbonBar();
9-
AutomationRibbonCommandBar commandBar = ribbon.getRibbonCommandBar();
10-
AutomationRibbonWorkPane pane = commandBar.getRibbonWorkPane();
8+
RibbonBar ribbon = window.getRibbonBar();
9+
RibbonCommandBar commandBar = ribbon.getRibbonCommandBar();
10+
RibbonWorkPane pane = commandBar.getRibbonWorkPane();
1111
logger.info("First work pane is " + pane.name());
1212
13-
AutomationNUIPane uiPane = pane.getNUIPane(Search.getBuilder(0).build());
13+
NUIPane uiPane = pane.getNUIPane(Search.getBuilder(0).build());
1414
logger.info("First NUIPane is " + uiPane.name());
1515
16-
AutomationNetUIHWND uiHWND = uiPane.getNetUIHWND(Search.getBuilder(0).build());
16+
NetUIHWND uiHWND = uiPane.getNetUIHWND(Search.getBuilder(0).build());
1717
18-
AutomationButton btn = uiHWND.getButton("Minimise the Ribbon");
18+
Button btn = uiHWND.getButton("Minimise the Ribbon");
1919
20-
AutomationTab tab = uiHWND.getTab(Search.getBuilder(0).build());
20+
Tab tab = uiHWND.getTab(Search.getBuilder(0).build());
2121
tab.selectTabPage("View");
2222
23-
AutomationPanel panel = uiHWND.getPanel(Search.getBuilder("Lower Ribbon").build());
24-
AutomationToolBar panes = panel.getToolBar("Panes");
23+
Panel panel = uiHWND.getPanel(Search.getBuilder("Lower Ribbon").build());
24+
ToolBar panes = panel.getToolBar("Panes");
2525
2626
panes.getButton("Preview pane").click();
27-
AutomationSplitButton split = panes.getSplitButton(Search.getBuilder(""Navigation pane").build());
27+
SplitButton split = panes.getSplitButton(Search.getBuilder(""Navigation pane").build());
2828
split.click();
2929
```

docs/grids.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
## WFP
55
```
6-
AutomationDataGrid grid = window.getDataGrid(Search.getBuilder(0).build());
7-
AutomationDataGridCell cell = grid.getItem(0,0);
6+
DataGrid grid = window.getDataGrid(Search.getBuilder(0).build());
7+
DataGridCell cell = grid.getItem(0,0);
88
String itemName = item.name();
99
```
1010

@@ -13,8 +13,8 @@
1313
The [DelphiUIAutomation](https://github.com/markhumphreysjhc/DelphiUIAutomation) project introduced some Delphi controls that implement IUIAutomation providers, allowing them to be accessed by automation. The TAutomatedStringGrid is one of these, as the base Delphi (as of XE5 at least) control does not implement the Grid or Table interfaces and so is opaque to automation. In order to get the element associated with the specific TAutomationStringGrid, then this is done in the following manner.
1414

1515
```
16-
AutomationDataGrid grid = window.getDataGrid(Search.getBuilder(0).className("TAutomationStringGrid").build());
17-
AutomationDataGridCell item = grid.getItem(0,0);
16+
DataGrid grid = window.getDataGrid(Search.getBuilder(0).className("TAutomationStringGrid").build());
17+
DataGridCell item = grid.getItem(0,0);
1818
String itemName = item.name();
1919
```
2020

docs/hyperlink.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
* See [Element Discovery](element-discovery.md)
33

44
```
5-
AutomationHyperlink link = window.getHyperlink(Search.getBuilder(0).build());
5+
Hyperlink link = window.getHyperlink(Search.getBuilder(0).build());
66
link.click();
77
```

docs/maskedit.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ There does not seem to be an equivalent WPF control.
77

88
```
99
try {
10-
AutomationMaskedEdit me0 = window.getMaskedEdit(Search.getBuilder("AutomatedMaskEdit1").build());
10+
MaskedEdit me0 = window.getMaskedEdit(Search.getBuilder("AutomatedMaskEdit1").build());
1111
1212
// Get the current value
1313
String value = me0.getValue();

docs/menus.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The example below shows the current (as of 25/04/2016) support for 2 level menus
88

99
```
1010
try {
11-
AutomationMenuItem exit = menu.getMenuItem("File", "Exit");
11+
MenuItem exit = menu.getMenuItem("File", "Exit");
1212
exit.click();
1313
} catch (ElementNotFoundException ex) {
1414
..
@@ -18,10 +18,10 @@ The example below shows the current (as of 25/04/2016) support for 2 level menus
1818
### WPF Menus
1919

2020
```
21-
AutomationMainMenu mainMenu = window.getMenu(0);
21+
MainMenu mainMenu = window.getMenu(0);
2222
2323
// Get the first menu item (i.e. "File")
24-
AutomationMenuItem file = mainMenu.getItems().get(0);
24+
MenuItem file = mainMenu.getItems().get(0);
2525
file.expand();
2626
2727
// A short wait for the expand to work
@@ -32,7 +32,7 @@ The example below shows the current (as of 25/04/2016) support for 2 level menus
3232
}
3333
3434
// Look for a specific menu item (in this case 'exit' is the 4th entry)
35-
AutomationMenuItem exit = file.getItems().get(3);
35+
MenuItem exit = file.getItems().get(3);
3636
3737
exit.click();
3838
```
@@ -53,6 +53,6 @@ A popup menu is just another menu, and can be accessed in the same manner. In th
5353
}
5454
5555
// Should be able to get the popup menu here
56-
AutomationMenu popup = window.getMenu(0)
56+
Menu popup = window.getMenu(0)
5757
5858
```

docs/notepad.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Notepad is quite a simple application, and the following code is adapted from the demo program.
22

33
```
4-
application = automation.launchOrAttach("notepad.exe");
4+
Application application = automation.launchOrAttach("notepad.exe");
55
66
// Wait for the process to start
77
application.waitForInputIdle(5000);
88
9-
AutomationWindow window = automation.getDesktopWindow("Untitled - Notepad");
9+
Window window = automation.getDesktopWindow("Untitled - Notepad");
1010
String name = window.name();
1111
logger.info(name);
1212
@@ -15,7 +15,7 @@ Notepad is quite a simple application, and the following code is adapted from th
1515
1616
logger.info("Modal = " + window.isModal());
1717
18-
AutomationEditBox edit = window.getEditBox(Search.getBuilder(0).build());
18+
EditBox edit = window.getEditBox(Search.getBuilder(0).build());
1919
2020
edit.setValue("This is a test of automation");
2121
@@ -25,13 +25,13 @@ Notepad is quite a simple application, and the following code is adapted from th
2525
this.rest();
2626
2727
// Interact with menus
28-
AutomationMainMenu menu = window.getMainMenu();
28+
MainMenu menu = window.getMainMenu();
2929
30-
AutomationMenuItem exit = menu.getMenuItem("File", "Exit");
30+
MenuItem exit = menu.getMenuItem("File", "Exit");
3131
exit.click();
3232
33-
AutomationWindow popup = window.getWindow("Notepad");
34-
AutomationButton btn = popup.getButton("Don't Save");
33+
Window popup = window.getWindow("Notepad");
34+
Button btn = popup.getButton("Don't Save");
3535
3636
btn.click();
3737

docs/powerpoint.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ Powerpoint has a control hierarchy, and uses 'Slides' which are Custom controls.
33
![UISpy for Powerpoint](images/powerpoint.png)
44

55
```
6-
AutomationWindow window = application.getWindow("This is text.pptx - PowerPoint");
6+
Window window = application.getWindow("This is text.pptx - PowerPoint");
77
  logger.info(window.name());
88
9-
  AutomationPanel panelX = window.getPanel(Search.getBuilder().className("MDIClient").build());
9+
  Panel panelX = window.getPanel(Search.getBuilder().className("MDIClient").build());
1010
  logger.info(panelX.name());
1111
  logger.info(panelX.getClassName());
1212
13-
  AutomationPanel panel1 = panelX.getPanel(Search.getBuilder("PowerPoint Edit View - [This is text.pptx]").build());
13+
  Panel panel1 = panelX.getPanel(Search.getBuilder("PowerPoint Edit View - [This is text.pptx]").build());
1414
  logger.info(panelX.name());
15-
  AutomationPanel panel2 = panel1.getPanel(Search.getBuilder("Slide").build();
15+
  Panel panel2 = panel1.getPanel(Search.getBuilder("Slide").build();
1616
  logger.info(panel2.name());
17-
  AutomationPowerpointSlide slide = panel2.getPowerpointSlide(Search.getBuilder("Slide 1 - This is text").build());
17+
  PowerpointSlide slide = panel2.getPowerpointSlide(Search.getBuilder("Slide 1 - This is text").build());
1818
  logger.info(slide.name());
1919
2020
  // Oddly enough this is an image control, and has text in it's selection
21-
  AutomationImage image = slide.getImage((Search.getBuilder("Title TextBox").build());
21+
  Image image = slide.getImage((Search.getBuilder("Title TextBox").build());
2222
```
2323

0 commit comments

Comments
 (0)