I am using Selenium Webdriver
with C#
bindings and trying to switch from the old FirefoxDriver (pre-FF 47) to the new Marionette driver
(FF47 and above) and it's working great after some teething problems that seemed to be fixed with the release of Selenium 2.53.1
and FF 47.0.1
.
The only problem now is that it seems to have an issue selecting option tags under a select tag. The following code works for all other browsers that I am testing in (FF < 46, Chrome, IE). I am passing the following arguments into my dropdownSelect
function. The select IWebElement
and the text to search for. Here's the function definition:
public static void dropdownSelect(IWebDriver driver, IWebElement inObject, string inText)
I have tried use the SelectElement()
class as I have with all of the other browsers
select = new SelectElement(inObject);
//select the matching element
select.SelectByText(inText);
I've also tried getting a Collection of the option and scrolling through the collection using both Click()
:
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
ReadOnlyCollection<IWebElement> optDropdown;
optDropdown = inObject.FindElements(By.TagName("option"));
foreach (IWebElement thsItem in optDropdown)
{
//check for matching text
if (thsItem.Text == inText)
{
// 1/4 second wait
Thread.Sleep(250);
thsItem.Click()
//exit foreach loop
break;
}
}
and a javascript
click in place of the thsItem.Click()
piece of code
//click option element
js.ExecuteScript("arguments[0].click();", thsItem);
Nothing is ever selected and no error or exception is thrown. It just continues on its merry way without selecting anything
Am I doing something wrong or is this something that is still being worked out with the new Marionette driver?