I use to pick items from drop-down menus using `SelectElement` class in my automated tests and they worked just fine until I upgraded to Selenium 2.39 .
ALL (!) tests that use this class fail and I get error message: `"Element is not currently visible and so may not be interacted with".`
I presume there is a bug in 2.39. Tested on Firefox 26.0. Anyone knows how to fix this problem?
//Here's a piece of my HTML:
<select id="CodGender" class="ui-selectmenu-element" name="CodGender" data-val-required="Mandatory attribute" data-val="true" aria-disabled="false">
<option value=""></option>
<option value="M">Male</option>
<option value="Z">Female</option>
</select>
//and here's how I'd pick an item from the drop-down:
{ var dropDownList = driver.FindElement(By.XPath("[@id='CodGender']"));
var selectElement = new SelectElement(dropDownList);
selectElement.SelectByText("Male");
}
這裏有一個「下拉列表」快速監視窗口結果傳遞的第二行代碼後: 顯示假 啓用真正 位置{X = -1658 Y = 791} 選擇假 尺寸{寬度= 200高度= 30} 變量名 「選擇」 文本 「」SelectElement硒2.39失敗
...這是一個爲 「selectElement」: AllSelectedOptions數= 1 IsMultiple假 選項計數= 3 [0] {OpenQA.Selenium.Firefox.FirefoxWebElement} [1] {OpenQA.Selenium.Firefox.FirefoxWebElement} [2] {OpenQA.Selenium.Firefox.FirefoxWebElement}
...然後選擇第2號的樣子: [OpenQA.Selenium.Firefox.FirefoxWebElement] {} OpenQA.Selenium.Firefox.FirefoxWebElement顯示 假 啓用真正 位置{X = -1656 Y = 851} 選擇假 大小{寬度= 197高度= 16} TagName「選項」 文本「」 ...
即使通過您自己的調試,」select「也不可見,那麼用戶必須做些什麼才能看到它? – Arran