C# Innertext Selenium Webdriver中预选下拉列表值的Assert语句
我这里有一个html示例:C# Innertext Selenium Webdriver中预选下拉列表值的Assert语句,c#,selenium,webdriver,C#,Selenium,Webdriver,我这里有一个html示例: <select id="Something" style="color:#404040;background-color:White;font-family:Verdana;font-size:XX-Small;width:125px;z-index: 134" name="Something"> <option value="0">Please Choose Status</option> <option val
<select id="Something" style="color:#404040;background-color:White;font-family:Verdana;font-size:XX-Small;width:125px;z-index: 134" name="Something">
<option value="0">Please Choose Status</option>
<option value="1">Status1</option>
<option value="2">Status2</option>
然而,这三种方法似乎都在比较innertext和整个下拉列表
Instead of `"status2 compared to status1"`
我得到:“状态2”与“请选择状态\r\n状态1r\n状态2”相比
有人能给我提供C#语法来做一个断言语句吗
谢谢使用SelectElement
类和:
Instead of `"status2 compared to status1"`
SelectElement selectElm = new SelectElement(ddlFoo);
Assert.AreEqual("Status2", selectElm.SelectedOption.Text);