user2156720
user2156720

Reputation: 1

I cannot access radio button with selenium webdriver in c#

I cannot access the radio button with chrom websriver in selnium. I am writing my code in c# here is the code I am using

driver.FindElement(By.CssSelector("input[name=eventCategoryID]")).Click();
driver.FindElement(By.CssSelector("input[value=11]")).Click();

for this radio button

Upvotes: 0

Views: 1834

Answers (2)

Madhu
Madhu

Reputation: 497

Why dont you try XPath

 driver.FindElement(By.Xpath("")).Click();

Upvotes: -1

Andrew
Andrew

Reputation: 1989

You are missing some quotation marks. It should look like this:

driver.FindElement(By.CssSelector("input[name=\"eventCategoryID\"]")).Click();
driver.FindElement(By.CssSelector("input[value=\"11\"]")).Click();

The \ escapes the following quotation mark so that it doesn't end the string.

Upvotes: 2

Related Questions