Skip to content

Commit 2243f77

Browse files
authored
Update SessionManager to allow program files as WinAppDriver location (#7411)
1 parent cdbe074 commit 2243f77

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/Files.InteractionTests/SessionManager.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using OpenQA.Selenium.Appium;
22
using OpenQA.Selenium.Appium.Windows;
33
using System;
4+
using System.IO;
45
using System.Diagnostics;
56
using System.Threading;
67

@@ -43,7 +44,18 @@ public static void CreateSession(TestContext _)
4344
if (_session == null)
4445
{
4546
// WinAppDriver is probably not running, so lets start it!
46-
Process.Start(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
47+
if(File.Exists(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe"))
48+
{
49+
Process.Start(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
50+
}
51+
else if(File.Exists(@"C:\Program Files\Windows Application Driver\WinAppDriver.exe"))
52+
{
53+
Process.Start(@"C:\Program Files\Windows Application Driver\WinAppDriver.exe");
54+
}
55+
else
56+
{
57+
throw new Exception("Unable to start WinAppDriver since no suitable location was found.");
58+
}
4759

4860
Thread.Sleep(10000);
4961
_session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appiumOptions);

0 commit comments

Comments
 (0)