Beispiel #1
0
        public void Click_OnHtmlInputButtonWithEqualsSignInSearchParameterValue_Succeeds()
        {
            //Arrange
            using (var tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input type=""submit"" value=""="" onclick=""alert('onclick');""/>
    </body>
</html>"))
            {
                WebPage.Launch(tempFile.FilePath);
                var window = new WebPage("test");

                EnhancedHtmlInputButton button = window.Get <EnhancedHtmlInputButton>("Value==");

                //Act
                button.Click();

                window.PerformDialogAction(BrowserDialogAction.Ok);

                window.Close();
            }
        }
Beispiel #2
0
        public void HtmlInputButton_UsingSearchParameterWithValueAsKey_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 (var tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input type=""submit"" value=""Log In"" onclick=""alert('onclick');""/>
    </body>
</html>"))
            {
                WebPage.Launch(tempFile.FilePath);
                var window = new WebPage("test");

                EnhancedHtmlInputButton button = window.Get <EnhancedHtmlInputButton>("Value=Log In");

                //Act
                button.Click();

                if (WebPage.GetCurrentBrowser() is InternetExplorer)
                {
                    //read JavaScript alert text
                    var             popup = new EnhancedWinWindow("ClassName=#32770;Name=Message from webpage");
                    EnhancedWinText text  = popup.Get <EnhancedWinText>();
                    Assert.AreEqual("onclick", text.DisplayText);
                }

                window.PerformDialogAction(BrowserDialogAction.Ok);

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

                EnhancedHtmlInputButton button = window.Get <EnhancedHtmlInputButton>("Value=   Search   ");

                //Act
                button.Click();

                window.Close();
            }
        }