Beispiel #1
0
        /// <summary>
        /// Presses the add external urls button.
        /// </summary>
        public void PressAddExternalUrlsButton()
        {
            HtmlInputButton addExternalUrlsButton = this.EM.Selectors.SelectorsScreen.AddExternalUrlButton.AssertIsPresent("Add external urls button button");

            addExternalUrlsButton.Click();
            ActiveBrowser.WaitForAsyncRequests();
        }
Beispiel #2
0
        public void Click_OnHtmlInputButtonWithEqualsSignInSearchPropertyValue_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input type=""submit"" value=""="" onclick=""alert('onclick');""/>
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlInputButton button = browserWindow.Find <HtmlInputButton>(By.ValueAttribute("="));

                //Act
                button.Click();

                browserWindow.PerformDialogAction(BrowserDialogAction.Ok);

                browserWindow.Close();
            }
        }
        public void HtmlButtonTest()
        {
            HtmlInputButton button = webDriver.FindControl <HtmlInputButton>(By.Name("My Button"), 5);

            button.Click();
            Assert.AreEqual(webDriver.FindControl <HtmlElement>(By.Id("myLabel"), 5).Text, "Button Clicked");
        }
Beispiel #4
0
        public void HtmlInputButton_UsingSearchPropertyWithValueAsKey_Succeeds()
        {
            //Internet Explorer may display the message: Internet Explorer restricted this webpage from running scripts or ActiveX controls.
            //This security restriction prevents the alert message to appear.
            //To enable running scripts on the local computer, go to Tools > Internet options > Advanced > Security > [checkmark] Allow active content to run in files on My Computer

            //Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input type=""submit"" value=""Log In"" onclick=""alert('onclick');""/>
    </body>
</html>"))
            {
                BrowserWindow.Launch(tempFile.FilePath);
                var window = new BrowserWindowUnderTest("test");

                HtmlInputButton button = window.Find <HtmlInputButton>(By.ValueAttribute("Log In"));

                //Act
                button.Click();

                if (BrowserWindowUnderTest.GetCurrentBrowser() is InternetExplorer)
                {
                    //read JavaScript alert text
                    WinWindow popup = new WinWindow(By.Name("Message from webpage").AndSearchProperties("ClassName=#32770"));
                    WinText   text  = popup.Find <WinText>();
                    Assert.AreEqual("onclick", text.DisplayText);
                }

                window.PerformDialogAction(BrowserDialogAction.Ok);

                window.Close();
            }
        }
Beispiel #5
0
        public void HtmlInputButton_GetWithValueContainingWhitespace_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input name=""inputName"" type=""submit"" value=""   Search   "" />
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlInputButton button = browserWindow.Find <HtmlInputButton>(By.ValueAttribute("   Search   "));

                //Act
                button.Click();

                browserWindow.Close();
            }
        }
Beispiel #6
0
        public void HtmlInputButton_GetWithValueContainingWhitespace_Succeeds()
        {
            //Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input name=""inputName"" type=""submit"" value=""   Search   "" />
    </body>
</html>"))
            {
                BrowserWindow.Launch(tempFile.FilePath);
                var window = new BrowserWindowUnderTest("test");

                HtmlInputButton button = window.Find <HtmlInputButton>(By.ValueAttribute("   Search   "));

                //Act
                button.Click();

                window.Close();
            }
        }