Skip to content

Commit c3b3fca

Browse files
authored
Merge branch 'main' into appium-new-command-timeout
2 parents ad6a4d4 + cee32df commit c3b3fca

3 files changed

Lines changed: 33 additions & 14 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ FlaUI.WebDriver is a [W3C WebDriver2](https://www.w3.org/TR/webdriver2/) impleme
2121

2222
The following capabilities are supported:
2323

24-
| Capability Name | Description | Example value |
25-
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
26-
| platformName | Must be set to `windows` (case-insensitive). | `windows` |
27-
| appium:app | The path to the application. It is also possible to set app to `Root`. In such case the session will be invoked without any explicit target application. Either this capability, `appTopLevelWindow` or `appTopLevelWindowTitleMatch` must be provided on session startup. | `C:\Windows\System32\notepad.exe` |
28-
| appium:appArguments | Application arguments string, for example `/?`. |
29-
| appium:appTopLevelWindow | The hexadecimal handle of an existing application top level window to attach to, for example `0x12345` (should be of string type). Either this capability, `appTopLevelWindowTitleMatch` or `app` must be provided on session startup. | `0xC0B46` |
30-
| appium:appTopLevelWindowTitleMatch | The title of an existing application top level window to attach to, for example `My App Window Title` (should be of string type). Either this capability, `appTopLevelWindow` or `app` must be provided on session startup. | `My App Window Title` or `My App Window Title - .*` |
31-
| appium:newCommandTimeout | The number of seconds the to wait for clients to send commands before deciding that the client has gone away and the session should shut down. Default one minute (60). | `120` |
24+
| Capability Name | Description | Example value |
25+
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
26+
| platformName | Must be set to `windows` (case-insensitive). | `windows` |
27+
| appium:app | The path to the application, or in case of an UWP app, `<package family name>!App`. It is also possible to set app to `Root`. In such case the session will be invoked without any explicit target application. Either this capability, `appTopLevelWindow` or `appTopLevelWindowTitleMatch` must be provided on session startup. | `C:\Windows\System32\notepad.exe`, `Microsoft.WindowsCalculator_8wekyb3d8bbwe!App` |
28+
| appium:appArguments | Application arguments string, for example `/?`. | |
29+
| appium:appTopLevelWindow | The hexadecimal handle of an existing application top level window to attach to, for example `0x12345` (should be of string type). Either this capability, `appTopLevelWindowTitleMatch` or `app` must be provided on session startup. | `0xC0B46` |
30+
| appium:appTopLevelWindowTitleMatch | The title of an existing application top level window to attach to, for example `My App Window Title` (should be of string type). Either this capability, `appTopLevelWindow` or `app` must be provided on session startup. | `My App Window Title` or `My App Window Title - .*` |
31+
| appium:newCommandTimeout | The number of seconds the to wait for clients to send commands before deciding that the client has gone away and the session should shut down. Default one minute (60). | `120` |
3232

3333
## Getting Started
3434

35-
This driver currenlty is only available by building from source. Start the web driver service with:
35+
This driver currenlty can be downloaded as an executable. Start the web driver service with:
3636

3737
```PowerShell
3838
./FlaUI.WebDriver.exe --urls=http://localhost:4723/

src/FlaUI.WebDriver.UITests/SessionTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ public void NewSession_MultipleMatchingAppTopLevelWindowTitleMatch_ReturnsError(
102102
Assert.That(newSession, Throws.TypeOf<WebDriverArgumentException>().With.Message.EqualTo("Found multiple (2) processes with main window title matching 'FlaUI WPF Test App'"));
103103
}
104104

105+
[Test, Explicit("GitHub actions runner doesn't have calculator installed")]
106+
public void NewSession_UwpApp_IsSupported()
107+
{
108+
var driverOptions = FlaUIDriverOptions.App("Microsoft.WindowsCalculator_8wekyb3d8bbwe!App");
109+
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
110+
111+
var title = driver.Title;
112+
113+
Assert.That(title, Is.EqualTo("Calculator"));
114+
}
115+
105116
[Test]
106117
public void NewSession_AppTopLevelWindowTitleMatchNotFound_ReturnsError()
107118
{

src/FlaUI.WebDriver/Controllers/SessionController.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,21 @@ public async Task<ActionResult> CreateNewSession([FromBody] CreateSessionRequest
4848
{
4949
app = null;
5050
}
51-
else
52-
{
53-
bool hasArguments = capabilities.TryGetValue("appium:appArguments", out var appArguments);
51+
else
52+
{
53+
bool hasArguments = capabilities.TryGetValue("appium:appArguments", out var appArgumentsValue);
54+
var appArguments = hasArguments ? appArgumentsValue.GetString()! : "";
5455
try
5556
{
56-
var processStartInfo = new ProcessStartInfo(appPath.GetString()!, hasArguments ? appArguments.GetString()! : "");
57-
app = Core.Application.Launch(processStartInfo);
57+
if (appPath.GetString()!.EndsWith("!App"))
58+
{
59+
app = Core.Application.LaunchStoreApp(appPath.GetString()!, appArguments);
60+
}
61+
else
62+
{
63+
var processStartInfo = new ProcessStartInfo(appPath.GetString()!, appArguments);
64+
app = Core.Application.Launch(processStartInfo);
65+
}
5866
}
5967
catch(Exception e)
6068
{

0 commit comments

Comments
 (0)