Read a text and click on a particular row of a table using Selenium in Java -
i trying read , click value in row (row width=85) of table using selenium. far tried these 2 methods, unable locate value. attaching html code image.
findelementbyxpath("//table/tbody/tr[2]/td[2]"); findelementbyxpath("//table[@width=\"85\"]/tbody/tr[2]/td[2]");
any help, appreciated.
rely on id
attributes table element , first td
width="85"
inside:
findelementbyxpath('//div[@id="display"]/table[@id="tbldata"]//td[@width="85"]')
note relying on width
attribute doesn't seem reliable. alternatively, use indexes - second td
in first tr
tag inside table (indexing starts 1):
findelementbyxpath('//div[@id="display"]/table[@id="tbldata"]//tr[1]/td[2]')
Comments
Post a Comment