public void OpenNewTab()
        {
            NewWindowPage page = new NewWindowPage(driver);
            int           NumOfWindowHandlesStart = driver.WindowHandles.Count;

            page.clickOpenNewWindow();
            int NumOfWindowHandlesEnd = driver.WindowHandles.Count;

            Assert.AreEqual(NumOfWindowHandlesEnd, NumOfWindowHandlesStart + 1);
        }
Beispiel #2
0
        public void MultipleWindowsTest()
        {
            const string PageTitle = "New Window";

            InternetPage internetPage = new InternetPage(this.DriverContext);

            internetPage.OpenHomePage();
            internetPage.GoToMultipleWindowsPage();
            MultipleWindowsPage multipleWindowsPage = new MultipleWindowsPage(this.DriverContext);

            multipleWindowsPage.OpenNewWindowPage();
            NewWindowPage newWindowPage = new NewWindowPage(this.DriverContext);

            Assert.True(newWindowPage.IsPageTile(PageTitle), "wrong page title, should be {0}", PageTitle);
            Assert.True(newWindowPage.IsNewWindowH3TextVisible(PageTitle), "text is not equal to {0}", PageTitle);
        }
Beispiel #3
0
        public void handleNewWindow()
        {
            var    homePage = new HomePage(driver);
            String parentHandle = null, lastHandle = null;

            parentHandle = driver.CurrentWindowHandle;
            Console.WriteLine("Parent window's handle is: " + parentHandle);

            homePage.NewMessageWindow.Click();
            lastHandle = driver.WindowHandles.Last();
            Console.WriteLine("Last window's handle is: " + lastHandle);
            driver.SwitchTo().Window(driver.WindowHandles.Last());

            var newWindowPage = new NewWindowPage(driver);

            Console.WriteLine("Message on new window is: " + driver.Url);
            Assert.IsTrue(driver.Url.Contains("about:blank"), "Url is wrong or window doesn't exist");
            // Assert.AreEqual("This message window is only for viewing purposes", newWindowPage.NewMessageWindow.Text, "Message is wrong or doesn't exist")
        }