コード例 #1
0
        public void SelectItem_ByIndexOnHtmlComboBox_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"));

                comboBox.SelectIndex(1);

                //Assert
                Assert.AreEqual("Football", comboBox.SelectedItem);

                browserWindow.Close();
            }
        }