public void Initialize(string executableOrRunningApplication, string expectedTitle, Action dismissPromptsOnClosing, int implicitSecondsUntilTimeOut) { AppiumHelper.LaunchWinAppDriverIfNecessary(); var options = new AppiumOptions(); if (!File.Exists(executableOrRunningApplication)) { throw new FileNotFoundException($"File does not exist: {executableOrRunningApplication}"); } options.AddAdditionalCapability("app", executableOrRunningApplication); options.AddAdditionalCapability("unicodeKeyboard", true); options.AddAdditionalCapability("platform", "Windows"); try { Session = new WindowsDriver <AppiumWindowsElement>(new Uri("http://127.0.0.1:4723"), options); } catch (WebDriverException) { throw new Exception("WinAppDriver.exe process could not be contacted"); } if (Session?.SessionId == null) { throw new Exception("WinAppDriver.exe process could not be contacted"); } if (Session.Title != expectedTitle) { throw new Exception($"Title '{expectedTitle}' was expected, but it is '{Session.Title}'"); } Session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(implicitSecondsUntilTimeOut); DismissPromptsOnClosing = dismissPromptsOnClosing; }
public AppiumWebElement SearchWindowsElement(WindowsElementSearchSpec windowsElementSearchSpec, IList <string> log) { AppiumHelper.LaunchWinAppDriverIfNecessary(); var options = new AppiumOptions(); options.AddAdditionalCapability("app", "Root"); WindowsDriver <AppiumWindowsElement> desktopSession; try { desktopSession = new WindowsDriver <AppiumWindowsElement>(new Uri("http://127.0.0.1:4723"), options); } catch (WebDriverException) { throw new Exception("WinAppDriver.exe process could not be contacted"); } return(SearchWindowsElement(desktopSession, null, windowsElementSearchSpec, log)); }
public LoginPage(AppiumHelper helper) { Helper = helper; }