public static void SignIn(AppiumDriver <IWebElement> driver) { driver.Context = Constants.NATIVEAPP; driver.FindElementByXPath(UsernameField).Clear(); driver.FindElementByXPath(UsernameField).SendKeys(Constants.MAYO_USERNAME); driver.FindElementByXPath(PasswordField).SendKeys(Constants.MAYO_PASSWORD); Thread.Sleep(1000); if (PerfectoUtils.IsiPad()) { if (PerfectoUtils.OCRTextCheckPoint(driver, "Privacy policy", 6, false)) { driver.FindElementByXPath(PrivacyPolicySwitch).Click(); Thread.Sleep(2000); } } driver.FindElementByXPath(SignInButton).Click(); }
public static void ClickPatient(AppiumDriver <IWebElement> driver) { //Ipad has no home page if (PerfectoUtils.IsiPad()) { return; } if (PerfectoUtils.IsTablet()) { Console.WriteLine("About to click patient link - sleep for tablet " + PerfectoHooks.CurrentDevice.DeviceDetails.Name); Thread.Sleep(15000); } driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(25)); driver.FindElementByXPath(PatientButton).Click(); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(6)); //App sends to authenticate if haven't already authenticated after opening app try { if (driver.FindElementsByXPath(UsernameField).Count > 0) { Console.WriteLine("Redirected to sign in - attempt sign in " + PerfectoHooks.CurrentDevice.DeviceDetails.Name); SignInPage.SignIn(driver); } { Console.WriteLine("login screen not found " + PerfectoHooks.CurrentDevice.DeviceDetails.Name); } } catch (Exception) { } driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(15)); }