java - How to find Xpath for a dynamic element in selenium webdriver -
how click on particular "add task" link , when more add tasks there , couldn't able find unique xpath
in case add task comes when add new project, every-time new add task generates.
from understand, need locate "add tasks" link based on project name. project name node not expanded on screenshot, i'm assuming there a
element there too:
string projectname = "qrr"; driver.findelement(by.xpath("//tr/td[a = '" + projectname+ "']/following-sibling::td/a[. = 'add tasks']"));
this locate "add tasks" button qrr
project name.
or, can locate appropriate row , use "by link text" locator:
webelement row = driver.findelement(by.xpath("//tr[td/a = 'qrr']")); webelement addtasks = row.findelement(by.linktext("add tasks"));
Comments
Post a Comment