Saturday, October 29, 2011

CSS selectors

For selecting a particular column in a table.

XPATH : //table[@class='stb']//tr[2]/td[2]

CSS : css=table.stb tr:nth-child(2)>td:nth-child(1)

XPATH : //input[@name="myName"]

CSS : css=input[name=myName]

 XPATH : //a[@title="Sign In"]

CSS : css=a[title='Sign In']

css=a.addthis_counter>a:nth-child(2)

a class="addthis_counter addthis_bubble_style"  //With space btw css
driver.findElement(By.cssSelector("a[class~='addthis_bubble_style']"));

More information here

No comments:

Post a Comment