2

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.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
john cs
  • 2,220
  • 5
  • 32
  • 50

1 Answers1

5

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.

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195