I am trying to select an element in a drop down list. When I tried using Selenium C# only I was getting a Div error and was advised to use jQuery to do the select.The Div error is Element should have been select but was div. I have tried using sendkeys to select dropdown, bu then i get the error it cannot focus on element.
I currently have the following code, but I am not able to get it running:
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using OpenQA.Selenium.Chrome;
using WebAuto;
using System.Drawing.Imaging;
using OpenQA.Selenium.Support.UI;
using Selenium.WebDriver.Extensions.JQuery;
using OpenQA.Selenium.Remote;
namespace WebAuto
{
class AddTrade
{
[Test]
public static void AddTrade1()
{
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("webaddress");
var inputtext1 = driver.FindElement(OpenQA.Selenium.By.Id("lgLogin_txtUserId"));
inputtext1.SendKeys("User");
var inputpassword1 = driver.FindElement(OpenQA.Selenium.By.Id("lgLogin_txtPassword"));
inputpassword1.SendKeys("Password");
var inputbutton1 = driver.FindElement(OpenQA.Selenium.By.Id("btnLoginClient"));
inputbutton1.Click();
System.Threading.Thread.Sleep(3000);
driver.FindElement(OpenQA.Selenium.By.Id("s2id_selTrader")).Click();
$("#s2id_selTrader").val("Main Trader");
How can I fix this problem?