title: css Selector for selecting specific row and column in table in selenium webdriver
body: <p>When I try to find </p>
  
  <pre><code>css=table#Salarytable.dataTable.3.4 
  </code></pre>
  
  <p>in selenium ide, the cell is getting highlighted correctly. But when I use this locator in my selenium code..</p>
  
  <pre><code>String salary=driver.findElement(By.cssSelector("table#Salarytable.dataTable.3.4")).getText();
  </code></pre>
  
  <p>it is giving me error as illegal string present.
  EDIT:
  The html code is as follows:</p>
  
  <pre><code>&lt;table id="Salarytable" class="dataTable" cellspacing="0" border="0" style="border-collapse:collapse;"&gt;
  </code></pre>
  
  <p>The stacktrace is:</p>
  
  <pre><code>java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at FunctionLibrary.FrameworkFunctions.runDriverIteration(FrameworkFunctions.java:1959)
      at FunctionLibrary.FrameworkFunctions.setActionScript(FrameworkFunctions.java:999)
      at AutomatedScripts.TableTesting.main(TableTesting.java:20)
  Caused by: org.openqa.selenium.WebDriverException: An invalid or illegal string was specified
  Command duration or timeout: 31 milliseconds
  Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
  System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_35'
  Session ID: 5d42a483-5544-4622-97aa-fc4ce00622eb
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=14.0.1, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:396)
      at org.openqa.selenium.By$ByCssSelector.findElement(By.java:407)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
      at FunctionLibrary.FrameworkFunctions.tbl_GetCellData(FrameworkFunctions.java:3105)
      at ReusableActions.GeneralActions.BC_TableTesting(GeneralActions.java:69)
      ... 7 more
  Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: An invalid or illegal string was specified
  Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
  System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_35'
  Driver info: driver.version: unknown
  java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at FunctionLibrary.FrameworkFunctions.runDriverIteration(FrameworkFunctions.java:1959)
      at FunctionLibrary.FrameworkFunctions.setActionScript(FrameworkFunctions.java:999)
      at AutomatedScripts.TableTesting.main(TableTesting.java:20)
  Caused by: org.openqa.selenium.WebDriverException: An invalid or illegal string was specified
  Command duration or timeout: 31 milliseconds
  Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
  System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_35'
  Session ID: 5d42a483-5544-4622-97aa-fc4ce00622eb
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=14.0.1, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:396)
      at org.openqa.selenium.By$ByCssSelector.findElement(By.java:407)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
      at FunctionLibrary.FrameworkFunctions.tbl_GetCellData(FrameworkFunctions.java:3105)
      at ReusableActions.GeneralActions.BC_TableTesting(GeneralActions.java:69)
      ... 7 more
  Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: An invalid or illegal string was specified
  Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
  System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_35'
  Driver info: driver.version: unknown
  </code></pre>
  
  <p>I know how it is done using xpath but i want to do it specifically in css. How can I do it.
  EDIT: I have given table#Salarytable > tbody > tr:nth-of-type(3) > td:nth-of-type(4) for now in my webdriver code and it is working fine.however i dont understand how a locator(css=table#Salarytable.dataTable.3.4) which worked in selenium ide is not working in webdriver code.
   Thank you.</p>