Selecting a value from drop down | Selenium Webdriver Tutorial with c# |Selenium C# training
15% Colorful Festival Offer Avail now

Selenium C# Training Forum

Selecting a value from drop down

S
shobha bandaru Post 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

Instructor

gunjan Reply on 20/12/2018

Can you send me the zip file of the code

S
shobha bandaru Reply on 24/12/2018

Gunjan,

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

Thanks,
Shobha

G

Instructor

gunjan Reply on 26/12/2018

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