dimanche 1 mai 2016

Selenium: selecting element based on sibling element text

I have been working on a selenium script for: http://ift.tt/1rJLpLz

and want to select the element "Add to Compare" for "Sony Xperia" but its not locating. I have tried with cssSelector and xpath both but not able to figure out what i am doing wrong.

css - div.category-products > ul > li:nth-child(n):contains('Sony Xperia') > div > div.actions > ul > li:nth-child(2) > a

xpath - //h2/a[@title='Sony Xperia']/ul/li/a[text()='Add to Compare']

NOTE: The cssSelector is locating in chrome but not giving any result in Firefox

Aucun commentaire:

Enregistrer un commentaire