Skip to content

Commit 6a52908

Browse files
committed
Merged PR 1637882: Merge GitHub public changes into main development branch
Add Visual Studio cache directory to .gitignore Updated the readme Incorporating FAQ
2 parents 5186a4a + c58f715 commit 6a52908

File tree

2 files changed

+8
-53
lines changed

2 files changed

+8
-53
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ obj/
5454

5555
# except build/, which is used as an MSBuild target.
5656
!**/packages/build/
57+
58+
# Visual Studio 2015/2017 cache/options directory
59+
.vs/

README.md

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ This Github project provides:
1919

2020
## Getting Started
2121

22+
### Frequently Asked Questions
23+
24+
For answers to common questions and/or best practices in using WinAppDriver, please refer to our updated [FAQ page](https://github.com/Microsoft/WinAppDriver/wiki/Frequently-Asked-Questions).
25+
2226
### System Requirements
2327

2428
- Windows 10 PC
@@ -40,24 +44,6 @@ WinAppDriver.exe 10.0.0.10 4723/wd/hub
4044

4145
> **Note**: You must run `WinAppDriver.exe` as **administrator** to listen to a different IP address and port.
4246
43-
### Running on a Remote Machine
44-
45-
Windows Application Driver can run remotely on any Windows 10 machine with `WinAppDriver.exe` installed and running. This *test machine* can then serve any JSON wire protocol commands coming from the *test runner* remotely through the network. Below are the steps to the one-time setup for the *test machine* to receive inbound requests:
46-
47-
1. On the *test machine* you want to run the test application on, open up **Windows Firewall with Advanced Security**
48-
- Select **Inbound Rules** -> **New Rule...**
49-
- **Rule Type** -> **Port**
50-
- Select **TCP**
51-
- Choose specific local port (4723 is WinAppDriver standard)
52-
- **Action** -> **Allow the connection**
53-
- **Profile** -> select all
54-
- **Name** -> optional, choose name for rule (e.g. WinAppDriver remote)
55-
2. Run `ipconfig.exe` to determine your machine's local IP address
56-
> **Note**: Setting `*` as the IP address command line option will cause it to bind to all bound IP addresses on the machine
57-
3. Run `WinAppDriver.exe` as **administrator** with command line arguments as seen above specifying local IP and port
58-
4. On the *test runner* machine where the runner and scripts are, update the test script to point to the IP of the remote *test machine*
59-
5. Execute the test script on the *test runner* to perform the test actions against the test application on the remote *test machine*.
60-
6147

6248
## Samples
6349

@@ -115,40 +101,6 @@ NotepadSession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:472
115101
NotepadSession.FindElementByClassName("Edit").SendKeys("This is some text");
116102
```
117103

118-
### Creating a Desktop Session
119-
120-
One test session typically corresponds to one app top level window. As long as you have your session alive, you can send input interactions and navigate the app elements tree. On a Windows 10 PC however, an app could trigger external changes such as toast notifications, app tiles, etc. In addition, some apps also respond to external events that can be triggered through the start menu or other sources. Windows Application Driver supports all these scenarios by exposing the entire desktop through a **Root** session that can be created as shown below.
121-
122-
```c#
123-
DesiredCapabilities appCapabilities = new DesiredCapabilities();
124-
appCapabilities.SetCapability("app", "Root");
125-
DesktopSession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appCapabilities);
126-
127-
// Use the session to control the desktop
128-
DesktopSession.Keyboard.PressKey(OpenQA.Selenium.Keys.Command + "a" + OpenQA.Selenium.Keys.Command);
129-
```
130-
131-
### Attaching to an Existing App Window
132-
133-
In some cases, you may want to test applications that are not launched in a conventional way like shown above. For instance, the Cortana application is always running and will not launch a UI window until triggered through **Start Menu** or a keyboard shortcut. In this case, you can create a new session in Windows Application Driver by providing the application top level window handle as a hex string (E.g. `0xB822E2`). This window handle can be retrieved from various methods including the **Desktop Session** mentioned above. This mechanism can also be used for applications that have unusually long startup times. Below is an example of creating a test session for the **Cortana** app after launching the UI using a keyboard shortcut and locating the window using the **Desktop Session**.
134-
135-
```c#
136-
DesktopSession.Keyboard.SendKeys(Keys.Meta + "s" + Keys.Meta);
137-
138-
var CortanaWindow = DesktopSession.FindElementByName("Cortana");
139-
var CortanaTopLevelWindowHandle = CortanaWindow.GetAttribute("NativeWindowHandle");
140-
CortanaTopLevelWindowHandle = (int.Parse(CortanaTopLevelWindowHandle)).ToString("x"); // Convert to Hex
141-
142-
// Create session by attaching to Cortana top level window
143-
DesiredCapabilities appCapabilities = new DesiredCapabilities();
144-
appCapabilities.SetCapability("appTopLevelWindow", CortanaTopLevelWindowHandle);
145-
CortanaSession = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
146-
147-
// Use the session to control Cortana
148-
CortanaSession.FindElementByAccessibilityId("SearchTextBox").SendKeys("add");
149-
```
150-
151-
152104
## Supported Capabilities
153105

154106
Below are the capabilities that can be used to create Windows Application Driver session.
@@ -266,4 +218,4 @@ For more details visit the Appium documentation: <http://appium.io/slate/en/mast
266218

267219

268220
## Vote on New Features
269-
Add your feature request in [issues](../../issues/) or :+1: (+1) existing issues labeled as **Enhancement**
221+
Add your feature request in [issues](../../issues/) or :+1: (+1) existing issues labeled as **Enhancement**

0 commit comments

Comments
 (0)