public void NavigateForwardSystemApp() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.ExplorerAppId); session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session); var originalTitle = session.Title; //Assert.AreNotEqual(String.Empty, originalTitle); // Navigate Windows Explorer to change folder var targetLocation = @"%TEMP%\"; var addressBandRoot = session.FindElementByClassName("Address Band Root"); var addressToolbar = addressBandRoot.FindElementByAccessibilityId("1001"); // Address Band Toolbar session.Mouse.Click(addressToolbar.Coordinates); addressBandRoot.FindElementByAccessibilityId("41477").SendKeys(targetLocation + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(1000); // Sleep for 1 second var newTitle = session.Title; Assert.AreNotEqual(originalTitle, newTitle); // Navigate back to the original folder session.Navigate().Back(); Assert.AreEqual(originalTitle, session.Title); // Navigate forward to the target folder session.Navigate().Forward(); Assert.AreEqual(newTitle, session.Title); session.Quit(); }
public void NavigateForward_Browser() { session = Utility.CreateNewSession(CommonTestSettings.EdgeAppId, "-private " + CommonTestSettings.EdgeAboutFlagsURL); session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2); Thread.Sleep(TimeSpan.FromSeconds(3)); var originalTitle = session.Title; Assert.AreNotEqual(string.Empty, originalTitle); // Navigate to different URLs session.FindElementByAccessibilityId("addressEditBox").SendKeys(Keys.Alt + 'd' + Keys.Alt + CommonTestSettings.EdgeAboutTabsURL + Keys.Enter); Thread.Sleep(TimeSpan.FromSeconds(2)); var newTitle = session.Title; Assert.AreNotEqual(originalTitle, newTitle); // Navigate back to original URL session.Navigate().Back(); Thread.Sleep(TimeSpan.FromSeconds(2)); Assert.AreNotEqual(newTitle, session.Title); // Navigate forward to original URL session.Navigate().Forward(); Thread.Sleep(TimeSpan.FromSeconds(2)); Assert.AreEqual(newTitle, session.Title); EdgeBase.CloseEdge(session); }
public void NavigateForwardBrowser() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.EdgeAppId); session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session); session.FindElementByAccessibilityId("addressEditBox").SendKeys(CommonTestSettings.MicrosoftUrl + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds var originalTitle = session.Title; Assert.AreNotEqual(String.Empty, originalTitle); // Navigate to different URLs session.FindElementByAccessibilityId("addressEditBox").SendKeys(CommonTestSettings.GitHubUrl + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds var newTitle = session.Title; Assert.AreNotEqual(originalTitle, newTitle); // Navigate back to original URL session.Navigate().Back(); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds Assert.AreEqual(originalTitle, session.Title); // Navigate forward to original URL session.Navigate().Forward(); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds Assert.AreEqual(newTitle, session.Title); session.Quit(); }
public virtual void TestInit() { // Attempt to go back to the main page in case Alarm & Clock app is started in EditAlarm view try { alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } catch { session.Navigate().Back(); Thread.Sleep(TimeSpan.FromSeconds(1)); try { alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } catch { session.FindElementByAccessibilityId("Back").Click(); // Press back button if navigating back somehow failed alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } } Assert.IsNotNull(alarmTabElement); if (!alarmTabElement.Selected) { alarmTabElement.Click(); } }
public void NavigateBack_ModernApp() { session = Utility.CreateNewSession(CommonTestSettings.AlarmClockAppId); session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1); // Ensure alarms & clock are in Alarm Pivot view session.Navigate().Back(); session.DismissAlarmDialogIfThere(); try { session.FindElementByAccessibilityId("AlarmButton").Click(); } catch (InvalidOperationException) { session.FindElementByAccessibilityId("AlarmPivotItem").Click(); } // Navigate to New Alarm view session.FindElementByAccessibilityId("AddAlarmButton").Click(); Assert.IsNotNull(session.FindElementByAccessibilityId("EditAlarmHeader")); // Navigate back to the original view session.Navigate().Back(); session.DismissAlarmDialogIfThere(); Assert.IsNotNull(session.FindElementByAccessibilityId("AddAlarmButton")); }
public void TestInit() { // Restore Microsoft Edge to the main page by navigating the browser back in history for (int attempt = maxNavigationHistory; attempt > 0 && session.Title != startingPageTitle; attempt--) { session.Navigate().Back(); } }
public void NavigateForward_SystemApp() { session = Utility.CreateNewSession(CommonTestSettings.ExplorerAppId); var originalTitle = session.Title; Assert.AreNotEqual(string.Empty, originalTitle); // Navigate Windows Explorer to change folder session.Keyboard.SendKeys(Keys.Alt + "d" + Keys.Alt + CommonTestSettings.TestFolderLocation + Keys.Enter); Thread.Sleep(TimeSpan.FromSeconds(1)); var newTitle = session.Title; Assert.AreNotEqual(originalTitle, newTitle); // Navigate back to the original folder session.Navigate().Back(); Assert.AreEqual(originalTitle, session.Title); // Navigate forward to the target folder session.Navigate().Forward(); Assert.AreEqual(newTitle, session.Title); }
public void TestInit() { // Attempt to go back to the main page in case Alarm & Clock app is started in EditAlarm view try { alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } catch { session.Navigate().Back(); alarmTabElement = session.FindElementByAccessibilityId("AlarmPivotItem"); } Assert.IsNotNull(alarmTabElement); alarmTabElement.Click(); }
public void ErrorNavigateForwardNoSuchWindow() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.AlarmClockAppId); session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session); try { session.Close(); session.Navigate().Forward(); Assert.Fail("Exception should have been thrown"); } catch (System.InvalidOperationException exception) { Assert.AreEqual("Currently selected window has been closed", exception.Message); } }
public void NavigateBackModernApp() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.AlarmClockAppId); session = new WindowsDriver <WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session); // Navigate to New Alarm view session.FindElementByAccessibilityId("AlarmPivotItem").Click(); session.FindElementByAccessibilityId("AddAlarmButton").Click(); Assert.IsNotNull(session.FindElementByAccessibilityId("EditAlarmHeader")); // Navigate back to the original view session.Navigate().Back(); Assert.IsNotNull(session.FindElementByAccessibilityId("AlarmPivotItem")); session.Quit(); session = null; }
protected static RemoteWebElement GetStaleElement(WindowsDriver <WindowsElement> remoteSession) { RemoteWebElement staleElement = null; remoteSession.FindElementByAccessibilityId("addressEditBox").SendKeys(CommonTestSettings.MicrosoftUrl + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds var originalTitle = remoteSession.Title; Assert.AreNotEqual(string.Empty, originalTitle); // Navigate to GitHub page remoteSession.FindElementByAccessibilityId("addressEditBox").SendKeys(CommonTestSettings.GitHubUrl + OpenQA.Selenium.Keys.Enter); System.Threading.Thread.Sleep(3000); // Sleep for 3 seconds Assert.AreNotEqual(originalTitle, remoteSession.Title); // Save a reference to Homepage web link on the GitHub page and navigate back to home staleElement = remoteSession.FindElementByName("Homepage"); Assert.IsNotNull(staleElement); remoteSession.Navigate().Back(); System.Threading.Thread.Sleep(2000); Assert.AreEqual(originalTitle, session.Title); return(staleElement); }