public void ErrorStaleSessionId() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.AlarmClockAppId); IOSDriver <IOSElement> session1 = new IOSDriver <IOSElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session1); Assert.IsNotNull(session1.SessionId); IOSDriver <IOSElement> session2 = new IOSDriver <IOSElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session2); Assert.IsNotNull(session2.SessionId); Assert.AreNotEqual(session1.SessionId, session2.SessionId); string applicationTitle = session1.FindElementByClassName("ApplicationFrameWindow").Text; Assert.IsNotNull(applicationTitle); session1.Quit(); applicationTitle = session1.FindElementByClassName("ApplicationFrameWindow").Text; Assert.Fail("Exception should have been thrown"); }
public void FindElementByClassName() { IOSElement element = session.FindElementByClassName("PivotItem"); Assert.IsNotNull(element); Assert.AreEqual(alarmTabElement, element); }
public void AddFilesByOne(string input1) { ApplicationSession.FindElementByName("Pick Files").Click(); // Wait for 1 second until the dialog comes up System.Threading.Thread.Sleep(1000); // Open File Explorer var openFileDialog = ApplicationSession.FindElementByClassName("#32770"); openFileDialog.FindElementByClassName("Edit").Click(); openFileDialog.FindElementByClassName("Edit").SendKeys(input1 + OpenQA.Selenium.Keys.Enter); // Wait for 1 second until the dialog close System.Threading.Thread.Sleep(1000); }
public void NavigateForwardSystemApp() { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.ExplorerAppId); session = new IOSDriver <IOSElement>(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 static void TearDown() { // Close Notepad NotepadSession.Quit(); NotepadSession = null; // Launch Windows Explorer to delete the saved text file above DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", ExplorerAppId); IOSDriver <IOSElement> WindowsExplorerSession = new IOSDriver <IOSElement>(new Uri(AppDriverUrl), appCapabilities); Assert.IsNotNull(WindowsExplorerSession); // Create Desktop session to control context menu and access dialogs DesiredCapabilities desktopCapabilities = new DesiredCapabilities(); desktopCapabilities.SetCapability("app", "Root"); IOSDriver <IOSElement> DesktopSession = new IOSDriver <IOSElement>(new Uri(AppDriverUrl), desktopCapabilities); Assert.IsNotNull(DesktopSession); // Navigate Windows Explorer to the target save location folder var addressBandRoot = WindowsExplorerSession.FindElementByClassName("Address Band Root"); var addressToolbar = addressBandRoot.FindElementByAccessibilityId("1001"); // Address Band Toolbar WindowsExplorerSession.Mouse.Click(addressToolbar.Coordinates); addressBandRoot.FindElementByAccessibilityId("41477").SendKeys(TargetSaveLocation); var gotoButton = addressBandRoot.FindElementByName("Go to \"" + TargetSaveLocation + "\""); WindowsExplorerSession.Mouse.Click(gotoButton.Coordinates); // Locate the saved test file WindowsExplorerSession.FindElementByAccessibilityId("SearchEditBox").SendKeys(TestFileName); // Delete the located saved test file Thread.Sleep(1000); // Wait for 1 second var shellFolderView = WindowsExplorerSession.FindElementByName("Shell Folder View"); var targetFileItem = shellFolderView.FindElementByName("NotepadTestOutputFile.txt"); Assert.IsNotNull(targetFileItem); WindowsExplorerSession.Mouse.Click(targetFileItem.Coordinates); WindowsExplorerSession.Mouse.ContextClick(targetFileItem.Coordinates); Thread.Sleep(1000); // Wait for 1 second for the context menu to appear var contextMenu = DesktopSession.FindElementByName("Context"); Assert.IsNotNull(contextMenu); contextMenu.FindElementByAccessibilityId("30994").Click(); // Select Delete from the context menu item WindowsExplorerSession.Quit(); WindowsExplorerSession = null; DesktopSession.Quit(); DesktopSession = null; }
public void EnterText() { // Enter text into the edit field var editBox = NotepadSession.FindElementByClassName("Edit"); editBox.SendKeys(TextValue); // Enter TimeStamp NotepadSession.FindElementByName("Edit").Click(); NotepadSession.FindElementByName("Time/Date").Click(); }
public static void ClassInitialize(TestContext context) { DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CommonTestSettings.NotepadAppId); session = new IOSDriver <IOSElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appCapabilities); Assert.IsNotNull(session); Assert.IsNotNull(session.SessionId); editBox = session.FindElementByClassName("Edit"); Assert.IsNotNull(editBox); }
public void TestShouldCreateAndDestroyIOSSessions() { IOSElement element = driver.FindElementByClassName("XCUIElementTypeApplication"); String application_name = element.GetAttribute("name"); Assert.AreEqual("TestApp", application_name); driver.Quit(); Assert.Throws <WebDriverException>( () => { element.GetAttribute("name"); }); }
public void EnterText(string inputtext) { // Enter text into the edit field var editBox = NotepadSession.FindElementByClassName("Edit"); // Clear the edit field of any values editBox.SendKeys(inputtext); Assert.AreEqual(inputtext, editBox.Text); // Enter TimeStamp NotepadSession.FindElementByName("Edit").Click(); NotepadSession.FindElementByName("Time/Date").Click(); Assert.AreNotEqual(inputtext, editBox.Text); }
public static void TearDown() { List <string> filelist = new List <string>(); filelist.Add("NotepadAdvancedTestOutputFile1.txt"); filelist.Add("NotepadAdvancedTestOutputFile2.txt"); filelist.Add("NotepadAdvancedTestOutputFile3.txt"); filelist.Add("NotepadAdvancedTestOutputFile4.txt"); filelist.Add("NotepadAdvancedTestOutputFile5.txt"); //Change the font back to the default NotepadSession.FindElementByName("Format").Click(); System.Threading.Thread.Sleep(1000);// Wait for 1 second until the dialog comes up NotepadSession.FindElementByName("Font...").Click(); //Change the font size back to the default Lucida Console NotepadSession.FindElementByName("Lucida Console").Click(); //Change the font format back to the default regular NotepadSession.FindElementByName("Regular").Click(); //Change the font size back to the default size NotepadSession.FindElementByName("10").Click(); //close the font dialog NotepadSession.FindElementByName("OK").Click(); //Disable word wrap NotepadSession.FindElementByName("Format").Click(); NotepadSession.FindElementByName("Word Wrap").Click(); // Close Notepad NotepadSession.FindElementByName("File").Click(); NotepadSession.FindElementByName("Exit").Click(); System.Threading.Thread.Sleep(1000);// Wait for 1 second until the dialog comes up NotepadSession.FindElementByName("Don't Save").Click(); NotepadSession = null; // Launch Windows Explorer to delete the saved text file above DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", ExplorerAppId); IOSDriver <IOSElement> WindowsExplorerSession = new IOSDriver <IOSElement>(new Uri(AppDriverUrl), appCapabilities); Assert.IsNotNull(WindowsExplorerSession); // Create Desktop session to control context menu and access dialogs DesiredCapabilities desktopCapabilities = new DesiredCapabilities(); desktopCapabilities.SetCapability("app", "Root"); IOSDriver <IOSElement> DesktopSession = new IOSDriver <IOSElement>(new Uri(AppDriverUrl), desktopCapabilities); Assert.IsNotNull(DesktopSession); // Navigate Windows Explorer to the target save location folder Thread.Sleep(1000); // Wait for 1 second var addressBandRoot = WindowsExplorerSession.FindElementByClassName("Address Band Root"); var addressToolbar = addressBandRoot.FindElementByAccessibilityId("1001"); // Address Band Toolbar WindowsExplorerSession.Mouse.Click(addressToolbar.Coordinates); addressBandRoot.FindElementByAccessibilityId("41477").SendKeys(TargetSaveLocation + OpenQA.Selenium.Keys.Enter); // Locate the saved test files foreach (string file in filelist) { WindowsExplorerSession.FindElementByAccessibilityId("SearchEditBox").SendKeys(file); // Delete the located saved test file Thread.Sleep(1000); // Wait for 1 second var shellFolderView = WindowsExplorerSession.FindElementByName("Shell Folder View"); var targetFileItem = shellFolderView.FindElementByName(file); Assert.IsNotNull(targetFileItem); WindowsExplorerSession.Mouse.Click(targetFileItem.Coordinates); WindowsExplorerSession.Keyboard.SendKeys(OpenQA.Selenium.Keys.Delete); WindowsExplorerSession.Keyboard.SendKeys(OpenQA.Selenium.Keys.Escape); } WindowsExplorerSession.Quit(); WindowsExplorerSession = null; DesktopSession.Quit(); DesktopSession = null; }
public override IOSElement FindElement(IOSDriver <IOSElement> searchContext) { return(searchContext.FindElementByClassName(Value)); }