Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Innertext Selenium Webdriver中预选下拉列表值的Assert语句_C#_Selenium_Webdriver - Fatal编程技术网

C# Innertext Selenium Webdriver中预选下拉列表值的Assert语句

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

我这里有一个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 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);