Q:

selenium web driver - css selector/locator for table hearder

<table id="state_table" class="table" width="100%">
<thead>
<tr>
<th class="column_checkbox disabled">
<th class="sortable desc" data-type="stateid">ID</th>
<th class="sortable" data-type="name">Name</th>

webdriver code to sort the table by column header is
driver.findElement(By.cssSelector("th.sortable")).click();

This sorts the table by ID column. How do I sort the table by Name column using "Name" and not the data type="name"
Thanks

A:

Why bother with css? Using XPath, that should be something like
driver.findElement(By.xpath("//th[text()='Name']")).click();

