|
1 | 1 | using OpenQA.Selenium.Appium.Android;
|
| 2 | +using OpenQA.Selenium.Appium.Windows; |
2 | 3 | using Plugin.Maui.UITestHelpers.Core;
|
3 | 4 |
|
4 | 5 | namespace Plugin.Maui.UITestHelpers.Appium
|
@@ -60,11 +61,13 @@ CommandResponse LaunchApp(IDictionary<string, object> parameters)
|
60 | 61 | { "bundleId", _app.GetAppId() },
|
61 | 62 | });
|
62 | 63 | }
|
63 |
| - else if (_app.GetTestDevice() == TestDevice.Windows) |
| 64 | + else if (_app.Driver is WindowsDriver windowsDriver) |
64 | 65 | {
|
65 |
| -#pragma warning disable CS0618 // Type or member is obsolete |
66 |
| - _app.Driver.LaunchApp(); |
67 |
| -#pragma warning restore CS0618 // Type or member is obsolete |
| 66 | + // Appium driver removed the LaunchApp method in 5.0.0, so we need to use the executeScript method instead |
| 67 | + // Currently the appium-windows-driver reports the following commands as compatible: |
| 68 | + // startRecordingScreen,stopRecordingScreen,launchApp,closeApp,deleteFile,deleteFolder, |
| 69 | + // click,scroll,clickAndDrag,hover,keys,setClipboard,getClipboard |
| 70 | + windowsDriver.ExecuteScript("windows: launchApp", [_app.GetAppId()]); |
68 | 71 | }
|
69 | 72 | else
|
70 | 73 | {
|
@@ -122,11 +125,12 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
|
122 | 125 | { "bundleId", _app.GetAppId() },
|
123 | 126 | });
|
124 | 127 | }
|
125 |
| - else if (_app.GetTestDevice() == TestDevice.Windows) |
| 128 | + else if (_app.Driver is WindowsDriver windowsDriver) |
126 | 129 | {
|
127 |
| -#pragma warning disable CS0618 // Type or member is obsolete |
128 |
| - _app.Driver.CloseApp(); |
129 |
| -#pragma warning restore CS0618 // Type or member is obsolete |
| 130 | + // This is still here for now, but it looks like it will get removed just like |
| 131 | + // LaunchApp was in 5.0.0, in which case we may need to use: |
| 132 | + // windowsDriver.ExecuteScript("windows: closeApp", [_app.GetAppId()]); |
| 133 | + windowsDriver.CloseApp(); |
130 | 134 | }
|
131 | 135 | else
|
132 | 136 | _app.Driver.TerminateApp(_app.GetAppId());
|
|
0 commit comments