css - How to click on table record by.cssselector with partial text present in code snippet -
i have table header task details , tasktime. task details column contain text (perform operation roll no. 150) , onclick there java script operation performed , new page displayed in same window.
i want click on particular table cell 2nd or 3rd or cell using partial text roll no. using findelementby.cssselector.
below code snippet table gets updates , different roll no. gets added table
<tr class="pointer" onmouseover="this.style.cursor='hand'" title="perform" style=""> <td onclick="javascript:__dopostback">perform operation roll no. 150</td> <td onclick="javascript:__dopostback">07 jul 2015 05:26 pm</td> <tr class="pointer" onmouseover="this.style.cursor='hand'" title="perform" style=""> <td onclick="javascript:__dopostback">perform operation roll no. 161</td> <td onclick="javascript:__dopostback">07 jul 2015 05:18 pm</td> <tr class="pointer" onmouseover="this.style.cursor='hand'" title="perform" style=""> <td onclick="javascript:__dopostback">perform operation roll no. 155</td> <td onclick="javascript:__dopostback">07 jul 2015 05:13 pm</td>
note xpath not working , below table changes.
please try below xpath:
//td[contains(text(),'roll no. 161')]
this locate td
element has innerhtml/text roll no. 161
. can replace 161
other roll number want locate.
or
in case want click on 2nd, 3rd or other td
element respect text roll no. on list, can try these:
(//td[contains(text(),'roll no.')])[2]
this locate 2nd td
element in chronological order of dom representation contains innerhtml/text roll no.
.
(//td[contains(text(),'roll no.')])[3]
this locate 3rd td
element in chronological order of dom representation contains innerhtml/text roll no.
.
similarly, can replace last [2]
other number locate concerned element in page.
Comments
Post a Comment