Selvan, thanks for advice, it matches the problem but does not complitely cover it:
Several nodes have the same xpath:
//table[@id='ctl00_phF_form_edBatchNbr_gr']/tbody/tr/td/div/table[@id='ctl00_phF _form_edBatchNbr_gr_headerT']/thead/tr/td
So i would not prefer to hardcode them like this:
//table[@id='ctl00_phF_form_edBatchNbr_gr']/tbody/tr/td/div/table[@id='ctl00_phF _form_edBatchNbr_gr_headerT']/thead/tr/td
//table[@id='ctl00_phF_form_edBatchNbr_gr']/tbody/tr/td/div/table[@id='ctl00_phF _form_edBatchNbr_gr_headerT']/thead/tr/td[2]
//table[@id='ctl00_phF_form_edBatchNbr_gr']/tbody/tr/td/div/table[@id='ctl00_phF _form_edBatchNbr_gr_headerT']/thead/tr/td[3]
...
The best way is to distinguish tjem by text value, like this:
"//table[@id='ctl00_phF_form_edBatchNbr_gr']/tbody/tr/td/div/table[@id='ctl00_phF _form_edBatchNbr_gr_headerT']/thead/tr/td[text()='" + textValue + "' ]"
The proble is that in UI displayed text has some extra spaces at the end. So I need some kind of regexp on server side.
[text().contains('" + textValue + "') ] - something like this....
Is it also possible to use regexps for locators?
Example:
//td[@id='usrCaption_tlbTools_but2'] -> //td[@id.contains('usrCaption_tlbTools_but2']) something like this...\\