Reputation: 2280
The website I am trying to automate has some radio buttons like this:
<input type="radio" name="outputFormat" value="quicken" checked="checked">
<input type="radio" name="outputFormat" value="xls">
<input type="radio" name="outputFormat" value="csv" checked="on">
<input type="radio" name="outputFormat" value="quickbooks">
I am trying to select the 'CSV' option by CSS selector as that appears to be the only way to get it. This is what im trying:
driver.findElement(By.cssSelector("value=\"csv\"")).click();
However, this is giving me an invalid selector error.
Upvotes: 2
Views: 64
Reputation: 474161
You need to fix your CSS selector:
driver.findElement(By.cssSelector("input[value=csv]")).click();
Note that, the main problem with your selector is missing [
and ]
for the attribute check. There is also no need to put csv
into quotes in this case. [value=csv]
would also work, but it's better to be explicit about the element your are locating.
Upvotes: 5