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]"); 

table html code

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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -