示例#1
0
        public void SetText_OnHtmlEdit_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
@"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <input type=""text""/>
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);
                HtmlEdit inputTextBox = browserWindow.Find<HtmlEdit>();

                // Act
                inputTextBox.Text = "text";

                // Assert
                Assert.AreEqual("text", inputTextBox.Text);

                browserWindow.Close();
            }
        }
示例#2
0
        public void ClickAllControlsOnPage_UsingReflection_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <a href=""#"">test</a>
            <button>test</button>
            <input type=""text"" value=""test""/>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                ControlBase a = browserWindow.Find<HtmlHyperlink>(By.SearchProperties("InnerText=test"));
                a.Click();

                List<Type> list = new List<Type>();
                list.Add(typeof(HtmlHyperlink));
                list.Add(typeof(HtmlButton));
                list.Add(typeof(HtmlEdit));

                MethodInfo getMethodInfo = typeof(UITestControlExtensions).GetMethod("Find", BindingFlags.Public | BindingFlags.Static);

                foreach(Type t in list)
                {
                    MethodInfo test = getMethodInfo.MakeGenericMethod(t);

                    ControlBase control;

                    if ((t == typeof(HtmlEdit)) || (t == typeof(HtmlTextArea)))
                    {
                        control = (ControlBase)test.Invoke(null, new object[] { browserWindow, By.ValueAttribute("test") });
                    }
                    else
                    {
                        //window.Find<t>("InnerText=test");
                        control = (ControlBase)test.Invoke(null, new object[] { browserWindow, By.SearchProperties("InnerText=test") });
                    }

                    //Act
                    control.Click();

                    if (control is HtmlEdit)
                    {
                        (control as HtmlEdit).Text = "text";
                    }
                    else if (control is HtmlTextArea)
                    {
                        (control as HtmlTextArea).Text = "text";
                    }
                }

                browserWindow.Close();
            }
        }
示例#3
0
        public void Browser()
        {
            using (var homePage = new TempWebPage(Home))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Act
                BrowserWindow actual = mainPage.Browser;

                // Assert
                Assert.AreEqual(mainPage.UpperLeft.Browser, actual);
                Assert.AreEqual(mainPage.RebasedUpperLeft.Browser, actual);
                Assert.AreEqual(mainPage.UpperRight.Browser, actual);
                Assert.AreEqual(mainPage.RebasedUpperRight.Browser, actual);
                Assert.AreEqual(mainPage.LowerLeft.Browser, actual);
                Assert.AreEqual(mainPage.RebasedLowerLeft.Browser, actual);
                Assert.AreEqual(mainPage.LowerRight.Browser, actual);
                Assert.AreEqual(mainPage.RebasedLowerRight.Browser, actual);
            }
        }
示例#4
0
        public void FromProcess_GetWindowTitle_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>A Test</title>
            </head>
            <body/>
            </html>"))
            {
                BrowserWindow.Launch(webPage.FilePath);

                // Act
                BrowserWindow browserWindow = BrowserWindow.FromProcess(Process.GetProcessesByName("iexplore").Single(x => !string.IsNullOrEmpty(x.MainWindowTitle)));

                // Assert
                Assert.IsTrue(browserWindow.Title.Contains("A Test"), browserWindow.Title);

                browserWindow.Close();
            }
        }
示例#5
0
        public void HtmlControl_NonExistent_DoesNotExist()
        {
            //Arrange
            SmartMatchOptions smartMatchOptions = SmartMatchOptions.Control;

            try
            {
                //set SmartMatchOptions to None because we are using .Exists on an invalid control
                //remember previous setting so that it can be reset
                smartMatchOptions = Playback.PlaybackSettings.SmartMatchOptions;
                Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;

                using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            </body>
            </html>"))
                {
                    var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                    //Act
                    HtmlDiv div = browserWindow.Find<HtmlDiv>(By.Id("invalid"));

                    //Assert
                    Assert.IsFalse(div.Exists);

                    browserWindow.Close();
                }
            }
            finally
            {
                //reset default setting
                Playback.PlaybackSettings.SmartMatchOptions = smartMatchOptions;
            }
        }
示例#6
0
        public void SetText_UsingScreenObjects_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <div id=""div1"" >
            <div id=""div2"" >
                <input type=""text"" id=""edit""/>
            </div>
            </div>
            </body>
            </html>"))
            {
                var page = Page.Launch<HtmlTestPage>(webPage.FilePath);

                //Act
                page.Div1.Div2.Edit.Text = "test";

                //Assert
                Assert.IsTrue(page.Div1.Div2.Edit.Exists);
            }
        }
示例#7
0
        public void RebasedUpperLeft()
        {
            using (var homePage = new TempWebPage(Home))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Assert
                Assert.IsTrue(mainPage.RebasedUpperLeft.Self.Exists);
                Assert.IsTrue(mainPage.RebasedUpperLeft.CheckBoxExists);
            }
        }
示例#8
0
        public void NavigateToNonModalDialog()
        {
            using (var aboutPage = new TempWebPage(About))
            using (var homePage = new TempWebPage(string.Format(Home, Path.GetFileName(aboutPage.FilePath))))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Act
                var dialogScreen = mainPage.MiddlePageObject.NavigateToAboutPage();

                // Assert
                Assert.IsTrue(dialogScreen.FrameworkMessageExists);
            }
        }
示例#9
0
        public void HtmlTable_GetCellValueUsingTableWithTHInTBODY_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <table id=""tableId"" border=""1"">
            <tbody>
                <tr>
                    <th>Lun</th>
                    <th>Used Space</th>
                    <th>Free Space</th>
                    <th>Usage %</th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
                    <td>LUN_04</td>
                    <td>26534605227</td>
                    <td>15405750418</td>
                    <td>
                        <dl>
                            <dd>
                                <dl>
                                    <dd>
                                        <span>64.27%</span>
                                    </dd>
                                </dl>
                            </dd>
                        </dl>
                    </td>
                    <td></td>
                </tr>
            </tbody>
            </table>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                var table = browserWindow.Find<HtmlTable>(By.Id("tableId"));

                //Act
                table.FindRowAndClick("LUN_04", 0, HtmlTableSearchOptions.NormalTight);

                //Assert
                Assert.AreEqual("LUN_04", table.GetCellValue(1, 0).Trim());

                browserWindow.Close();
            }
        }
示例#10
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 (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <input type=""submit"" value=""Log In"" onclick=""alert('onclick');""/>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlInputButton button = browserWindow.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);
                }

                browserWindow.PerformDialogAction(BrowserDialogAction.Ok);

                browserWindow.Close();
            }
        }
示例#11
0
        public void GetHtmlRow_ById_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <table class=""cart"" cellspacing=""0"">
              <tbody>
            <tr id=""555002_gp2"">
                <td>
                    banana
                </td>
            </tr>
              </tbody>
            </table>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                // Act
                HtmlRow row = browserWindow.Find<HtmlRow>(By.Id("555002_gp2"));

                // Assert
                Assert.IsTrue(row.Exists);

                browserWindow.Close();
            }
        }
示例#12
0
        public void GetHtmlDiv_ByClass_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <div class=""button""><a href=""/main"">main text</a></div>
            <div class=""button""><a href=""/about"">about text</a></div>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                // Act
                HtmlDiv div = browserWindow.Find<HtmlDiv>(By.Class("button"));

                HtmlHyperlink about = browserWindow.Find<HtmlHyperlink>(By.SearchProperties("InnerText=about text;href~about"));
                HtmlDiv div2 = about.Parent as HtmlDiv;

                // Assert
                Assert.IsTrue(div.Exists);
                Assert.AreEqual("main text", div.SourceControl.InnerText);

                Assert.IsTrue(about.Exists);

                Assert.IsTrue(div2.Exists);
                Assert.AreEqual("about text", div2.SourceControl.InnerText);

                browserWindow.Close();
            }
        }
示例#13
0
        public void GetHtmlControl_OnHtml5Control_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <div class=""textbox"" id=""idDiv_PWD_UsernameTb"" style=""margin-bottom: 8px;"">
            <div style=""width: 100%; position: relative;"">
                <input name=""login"" id=""i0116"" style=""ime-mode: inactive;"" type=""email"" maxLength=""113""/>
                <div class=""phholder"" style=""left: 0px; top: 0px; width: 100%; position: absolute; z-index: 5;"">
                    <div class=""placeholder"" id=""idDiv_PWD_UsernameExample"" style=""cursor: text;"">
                    Text - [email protected]
                    </div>
                </div>
            </div>
            </body>
            </html>"))
            {
                var bWin = BrowserWindow.Launch(webPage.FilePath);

                // Act
                HtmlCustom txtUserName = bWin.Find<HtmlCustom>(By.Id("i0116").AndTagName("input"));

                // Assert
                Assert.IsTrue(txtUserName.Exists);

                Keyboard.SendKeys(txtUserName.SourceControl, "hello");

                //Assert
                Assert.AreEqual("hello", txtUserName.ValueAttribute);

                bWin.Close();
            }
        }
示例#14
0
        public void GetChildren_UsingHyperlinks_CanFindHyperlinkByInnerText()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <div id=""div1"">
            <a href=""#"">A - B - C</a>
            <a href=""#"">A - F - E</a>
            <a href=""#"">A - D - E</a>
            <a href=""#"">Z - B - C</a>
            <a href=""#"">Z - D - E</a>
            </div>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                IEnumerable<ControlBase> collection = browserWindow.Find<HtmlDiv>(By.Id("div1")).GetChildren();
                foreach (ControlBase control in collection)
                {
                    if (control is HtmlHyperlink)
                    {
                        HtmlHyperlink link = (HtmlHyperlink)control;
                        if (link.InnerText.StartsWith("A"))
                        {
                            Trace.WriteLine(string.Format("found: {0}", link.InnerText));
                        }
                    }
                }

                browserWindow.Close();
            }
        }
示例#15
0
        public void GetChildrenOfSameType()
        {
            // Arrange
            using (var webPage = new TempWebPage(
                @"<html>
                    <head>
                        <title>test</title>
                    </head>
                    <body>
                        <div id=""panel"">
                            <p>1</p>
                            <p>2</p>
                            <p>3</p>
                        </div>
                    </body>
                </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);
                var panel = browserWindow.Find<HtmlDiv>(By.Id("panel"));

                // Act
                ControlBase[] children = panel.GetChildren().ToArray();

                // Assert
                Assert.AreEqual(3, children.Length);

                Assert.IsInstanceOfType(children[0], typeof(HtmlParagraph));
                Assert.AreEqual("1", ((HtmlParagraph)children[0]).InnerText);

                Assert.IsInstanceOfType(children[1], typeof(HtmlParagraph));
                Assert.AreEqual("2", ((HtmlParagraph)children[1]).InnerText);

                Assert.IsInstanceOfType(children[2], typeof(HtmlParagraph));
                Assert.AreEqual("3", ((HtmlParagraph)children[2]).InnerText);

                browserWindow.Close();
            }
        }
示例#16
0
        public void Enabled_OnDisabledHtmlInputButton_ReturnsFalse()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <input name=""inputName"" type=""submit"" value=""Click here"" disabled=""disabled"" />
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

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

                // Act and Assert
                Assert.IsFalse(button.Enabled);

                browserWindow.Close();
            }
        }
示例#17
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();
            }
        }
示例#18
0
        public void HtmlFileInput_SetFile_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <input name=""inputName"" type=""file"" id=""inputId"" />
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlFileInput fileInput = browserWindow.Find<HtmlFileInput>(By.Id("inputId"));

                string tempInputFilePath = Path.GetTempFileName();

                //Act
                fileInput.FileName = tempInputFilePath;

                browserWindow.Close();

                File.Delete(tempInputFilePath);
            }
        }
示例#19
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();
            }
        }
示例#20
0
        public void GetSelectedValue_OfRadioButton_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <input type=""radio"" name=""radio:tab1:gender.type.male"" value=""male"" checked=checked>Male</input><br/>
            <input type=""radio"" name=""radio:tab1:gender.type.female"" value=""female"">Female</input><br/>
            <input type=""radio"" name=""radio:tab1:gender.type.other"" value=""other"">Other</input><br/>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                // Act
                HtmlRadioButton genderTypeMale = browserWindow.Find<HtmlRadioButton>(By.Name("radio:tab1:gender.type.male"));

                // Assert
                Assert.IsTrue(genderTypeMale.Selected);
                Assert.AreEqual("male", genderTypeMale.ValueAttribute);

                browserWindow.Close();
            }
        }
示例#21
0
        public void HtmlTable_FindHeaderAndClick_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <table style=""width: 100%;"" id=""tableId"">
            <tbody>
                <tr>
                    <td>Commitment</td>
                    <th>September</th>
                    <th>October</th>
                    <th>November</th>
                    <td>Total</td>
                </tr>
                <tr>
                    <td>Beginning Balance</td>
                    <td>¥21,570,253</td>
                    <td>¥21,375,491</td>
                    <td>¥21,200,873</td>
                    <td></td>
                </tr>
                <tr>
                    <td>New Purchases</td>
                    <td>¥0</td>
                    <td>¥0</td>
                    <td>¥0</td>
                    <td></td>
                </tr>
                <tr>
                    <td>Utilized</td>
                    <td>¥194,762</td>
                    <td>¥174,618</td>
                    <td>¥0</td>
                    <td>¥369,380</td>
                </tr>
                <tr>
                    <td>Ending Balance</td>
                    <td>¥21,375,491</td>
                    <td>¥21,200,873</td>
                    <td>¥21,200,873</td>
                    <td></td>
                </tr>
                <tr>
                    <td><b>Overage</b></td>
                    <td>¥0</td>
                    <td>¥0</td>
                    <td>¥0</td>
                    <td>¥0</td>
                    <td></td>
                </tr>
                <tr>
                    <td><b>Total Usage</b></td>
                    <td>¥194,762</td>
                    <td>¥174,618</td>
                    <td>¥0</td>
                    <td>¥369,380</td>
                </tr>
            </tbody>
            </table>
            </body>
            </html>"))
            {

                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                var table = browserWindow.Find<HtmlTable>(By.Id("tableId"));

                //Act
                table.FindHeaderCellAndClick(0, 2);

                browserWindow.Close();
            }
        }
示例#22
0
        public void Get_UsingMultipleValuesOfClassAttributeWithContainsOperatorOfHtmlSpan_ReturnsTheSpecificElementWithAllSpecifiedClassValues()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <span name=""span1"" class=""class1"" />
            <span name=""span2"" class=""class1 class4"" />
            <span name=""span3"" class=""class1 class2 class3"" />
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlSpan span3 = browserWindow.Find<HtmlSpan>(By
                    .ClassContains("class1")
                    .AndClassContains("class2"));

                // Act and Assert
                Assert.AreEqual("span3", span3.SourceControl.Name);

                browserWindow.Close();
            }
        }
示例#23
0
        public void HtmlButton_HiddenByStyle_ControlExistsAndCanAssertOnStyle()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <button id=""buttonId"" style=""display: none;"" >Hidden</button>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                HtmlButton button = browserWindow.Find<HtmlButton>(By.Id("buttonId"));

                //Assert
                Assert.IsTrue(button.Exists);

                Assert.IsTrue(button.SourceControl.ControlDefinition.Contains("style=\"display: none;\""));

                browserWindow.Close();
            }
        }
示例#24
0
        public void HtmlCheckBox_DisabledByStyle_ControlExistsAndCanGetCheckedState()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <input type=""checkbox"" id=""checkBoxId"" disabled=""disabled"" name=""checkBoxName"" checked=""checked"" />
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                HtmlCheckBox checkBox = browserWindow.Find<HtmlCheckBox>(By.Id("checkBoxId"));

                //Assert
                Assert.IsTrue(checkBox.Exists);
                Assert.IsTrue(checkBox.Checked);

                browserWindow.Close();
            }
        }
示例#25
0
        public void RebasedLowerRight()
        {
            using (var homePage = new TempWebPage(Home))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Assert
                Assert.IsTrue(mainPage.RebasedLowerRight.Self.Exists);
                Assert.IsTrue(mainPage.RebasedLowerRight.RadioButtonExists);
            }
        }
示例#26
0
        public void SelectItem_UsingHtmlComboBoxThatAlertsOnChange_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <select id=""selectId"" onchange=""alert('onchange');"">
            <option>Apple</option>
            <option>Banana</option>
            <option>Carrot</option>
            </select>
            </body>
            </html>"))
            {
                var window = BrowserWindow.Launch(webPage.FilePath);

                HtmlComboBox comboBox = window.Find<HtmlComboBox>(By.Id("selectId"));

                comboBox.SetFocus();

                //Act
                // select item "Banana"
                Keyboard.SendKeys(comboBox.SourceControl, "{DOWN}");

                window.PerformDialogAction(BrowserDialogAction.Ok);

                window.Close();
            }
        }
示例#27
0
        public void UpperRight()
        {
            using (var homePage = new TempWebPage(Home))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Assert
                Assert.IsTrue(mainPage.UpperRight.CheckBoxExists);
            }
        }
示例#28
0
        public void HtmlComboBox_Items_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <select id=""selectId"">
            <option>Cricket</option>
            <option>Football</option>
            <option>Tennis</option>
            </select>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                //Act
                HtmlComboBox comboBox = browserWindow.Find<HtmlComboBox>(By.Id("selectId"));

                //Assert
                Assert.AreEqual("Football", comboBox.Items[1]);
                Assert.IsTrue(comboBox.Items.Contains("Cricket"));

                browserWindow.Close();
            }
        }
示例#29
0
        public void LowerLeft()
        {
            using (var homePage = new TempWebPage(Home))
            {
                // Arrange
                var mainPage = Page.Launch<MainPage>(homePage.FilePath);

                // Assert
                Assert.IsTrue(mainPage.LowerLeft.RadioButtonExists);
            }
        }
示例#30
0
        public void SetText_OnHtmlPassword_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
            @"<html>
            <head>
            <title>test</title>
            </head>
            <body>
            <div class=""row textbox"" id=""idDiv_PWD_PasswordTb"">
            <div style=""width: 100%; position: relative;"">
                <input name=""passwd"" id=""i0118"" aria-labelledby=""idDiv_PWD_PasswordExample"" type=""password"" autocomplete=""off"">
                    <div class=""phholder"" style=""left: 0px; top: 0px; width: 100%; position: absolute; z-index: 5;"">
                        <div class=""placeholder"" id=""idDiv_PWD_PasswordExample"" aria-hidden=""true"" style=""cursor: text;"">Password</div>
                    </div>
            </div>
            </div>
            </body>
            </html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                HtmlPassword txtPwd = browserWindow.Find<HtmlPassword>(By.Id("i0118"));

                // Act
                txtPwd.Text = "hello";

                // TODO: Assert
                browserWindow.Close();
            }
        }