public void SelectItem_UsingHtmlComboBoxThatAlertsOnChange_Succeeds() { //Arrange using (var tempFile = new TempFile( @"<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>")) { WebPage.Launch(tempFile.FilePath); var window = new WebPage("test"); EnhancedHtmlComboBox comboBox = window.Get <EnhancedHtmlComboBox>("Id=selectId"); //Act comboBox.SelectItem("Banana"); window.PerformDialogAction(BrowserDialogAction.Ok); window.Close(); } }
public void InnerText_OnHtmlComboBoxWithDisabledItems_Succeeds() { //Arrange using (var tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <select id=""selectId""> <option value=""1"">1</option> <option value=""2"" disabled=""disabled"">2</option> <option value=""3"" disabled=""disabled"">3</option> </select> </body> </html>")) { WebPage.Launch(tempFile.FilePath); var window = new WebPage("test"); EnhancedHtmlComboBox comboBox = window.Get <EnhancedHtmlComboBox>("Id=selectId"); //Assert Assert.AreEqual(3, comboBox.ItemCount); CollectionAssert.AreEqual(new[] { "1", "2", "3" }, comboBox.Items); Assert.AreEqual("1 2 3 ", comboBox.InnerText); window.Close(); } }
public void SelectItem_ByIndexOnHtmlComboBox_Succeeds() { //Arrange using (var tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <select id=""selectId""> <option>Cricket</option> <option>Football</option> <option>Tennis</option> </select> </body> </html>")) { WebPage.Launch(tempFile.FilePath); var window = new WebPage("test"); //Act EnhancedHtmlComboBox comboBox = window.Get <EnhancedHtmlComboBox>("Id=selectId"); comboBox.SelectItem(1); //Assert Assert.AreEqual("Football", comboBox.SelectedItem); window.Close(); } }