Selecting a value from drop down | Selenium C# Forum
S
shobha bandaru Posted on 17/12/2018
The following code is not working:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support;

namespace ConsoleApp1
{
class dropdown
{
public static void Main(string[] args)
{
IWebDriver driver = null;
driver = new InternetExplorerDriver(@"C:\Users\sbandaru\Desktop\example\Drivers");

driver.Url = "http://seleniumtraining.com/contact-us";

IWebElement x = driver.FindElement(By.Name("country_id"));

x.SendKeys("Algeria");

//Console.WriteLine("Total items in the drop down are:" + x)

Console.ReadKey();

}
}
}

G
gunjan Replied on 20/12/2018

Can you send me the zip file of the code


S
shobha bandaru Replied on 24/12/2018

Gunjan,

Please find the attached code. Tried in different ways but no luck.

Thanks,
Shobha


G
gunjan Replied on 26/12/2018

Hi Shobha,
The same code is working fine from my end. Please check once again.