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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -