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
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.
您为什么不尝试XPath
driver.FindElement(By.Xpath("")).Click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.