I am trying a select a text from the Dropdown Menu using Selenium webdriver in C# It is working perfectly with Chrome browser, but not with Firefox. Could any one help me to fix this.
The code I am using is given below.
public void SelectCountry1(string country)
{
var countryDropDown = Driver.FindElement(By.XPath(xpathidofthecountrydropdown));
countryDropDown .Click();
//Driver.FindElement(By.XPath(xpathidofthecountrydropdown)).Click;
var selectElement = new SelectElement(countryDropDown);
selectElement.SelectByText(country);
}
I am able to call this function and this is executing successfully without any error messages. I am not able to select the expected keyword eventhough it exists.
Currently I am having a workaround of Clicking on the same id twice and that makes the code to work. With the commented section uncommented But I dont think that is correct workaround. Let me know your thoughts on this.
Thanks