Skip to content

Commit

Permalink
Add support to run appium-windows-driver for Windows apps
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcroft committed Mar 15, 2024
1 parent f32288e commit 25e734a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/Legerity.Core/Android/AndroidAppManagerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ public AndroidAppManagerOptions(
/// </summary>
public string DeviceId { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to launch the Appium server instance.
/// </summary>
public bool LaunchAppiumServer { get; set; }

/// <summary>
/// Configures the <see cref="AppiumManagerOptions.AppiumOptions"/> with the specified additional options.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Legerity.Core/AppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ private static WebDriver StartAndroidApp(AndroidAppManagerOptions androidOpts)

private static WebDriver StartWindowsApp(WindowsAppManagerOptions winOpts)
{
if (winOpts.LaunchWinAppDriver)
if (winOpts.LaunchAppiumServer || winOpts.LaunchWinAppDriver)
{
WinAppDriverHelper.Run();
AppiumServerHelper.Run();
}

var app = new WindowsDriver(
Expand Down
5 changes: 5 additions & 0 deletions src/Legerity.Core/AppiumManagerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public AppiumOptions AppiumOptions
set => DriverOptions = value;
}

/// <summary>
/// Gets or sets a value indicating whether to launch the Appium server instance.
/// </summary>
public bool LaunchAppiumServer { get; set; }

/// <summary>
/// Configures the <see cref="AppiumOptions"/> with the specified additional options.
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Legerity.Core/IOS/IOSAppManagerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ public IOSAppManagerOptions(
/// </summary>
public string AutomationName { get; set; } = "XCUITest";

/// <summary>
/// Gets or sets a value indicating whether to launch the Appium server instance.
/// </summary>
public bool LaunchAppiumServer { get; set; }

/// <summary>
/// Configures the <see cref="AppiumManagerOptions.AppiumOptions"/> with the specified additional options.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Legerity.Core/Windows/Helpers/WinAppDriverHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Legerity.Windows.Helpers;
/// <summary>
/// Defines a helper class for the WinAppDriver.
/// </summary>
[Obsolete("WinAppDriver is not well maintained and is not supported directly by Appium 5 due to W3C standards. Instead, install the appium-windows-driver for the Appium CLI, and use the AppiumServerHelper to initialize.")]
public static class WinAppDriverHelper
{
/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion src/Legerity.Core/Windows/WindowsAppManagerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Legerity.Windows;

using System.Collections.Generic;
Expand Down Expand Up @@ -49,6 +51,7 @@ public WindowsAppManagerOptions(string appId, params (string, object)[] addition
/// <summary>
/// Gets or sets a value indicating whether to launch the WinAppDriver if it is not already running.
/// </summary>
[Obsolete("Please use LaunchAppiumServer instead. LaunchWinAppDriver will continue to function, however, the WinAppDriver will not be launched directly due to no direct support by the W3C standard implemented in Appium 5. This property will be removed in a future release.")]
public bool LaunchWinAppDriver { get; set; }

/// <summary>
Expand All @@ -70,7 +73,8 @@ public WindowsAppManagerOptions(string appId, params (string, object)[] addition
public override void Configure()
{
base.Configure();
AppiumOptions.AddAdditionalAppiumOption("app", AppId);
AppiumOptions.App = AppId;
AppiumOptions.AutomationName = "Windows";
}

/// <summary>
Expand Down

0 comments on commit 25e734a

Please sign in to comment.