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
  • 441,113
  • 110
  • 1,021
  • 1,148
john cs
  • 2,144
  • 5
  • 28
  • 48

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
  • 441,113
  • 110
  • 1,021
  • 1,148