Currently, I am utilizing Selenium Webdriver alongside C# bindings and transitioning from the outdated FirefoxDriver (pre-FF 47) to the newer Marionette driver (FF47 and above). The switch has been successful after encountering some initial challenges that were resolved with the update of Selenium 2.53.1 and FF 47.0.1.
However, an issue arises when attempting to select option tags within a select tag. The code functions properly for all other browsers tested (FF < 46, Chrome, IE). Parameters passed into the dropdownSelect function include the select IWebElement and the desired search text. Here is the definition of the function:
public static void dropdownSelect(IWebDriver driver, IWebElement inObject, string inText)
I have experimented with using the SelectElement() class similar to other browsers:
select = new SelectElement(inObject);
//select the matching element
select.SelectByText(inText);
Additionally, I attempted to retrieve a Collection of the options and iterate through them using 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)
{
Thread.Sleep(250); // 1/4 second wait
thsItem.Click();
//exit foreach loop
break;
}
}
I also tried invoking a javascript click instead of thsItem.Click():
//click option element
js.ExecuteScript("arguments[0].click();", thsItem);
Although no errors or exceptions are thrown, nothing gets selected. It progresses without any selection made. Is there an error on my end, or is this still a work in progress with the Marionette driver?