java - Cannot find image in table in Selenium -
can help, cannot find image in table javascript , if finds should browse webpage. , how can see println output in intellij, because didn't find output associated println.
webelement image = driver.findelement(by.xpath("//img[@src='http://m.com/en/images/common/green_check.png']")); boolean imagepresent = (boolean) ((javascriptexecutor)driver).executescript ( "return arguments[0].complete && type of arguments[0].naturalwidth != \"undefined\" && arguments[0].naturalwidth > 0", image ); if (!imagepresent) { system.out.println("image isn't displayed."); } else { driver.get("https://www.google.de/?gfe_rd=cr&ei=rkxawnspiexjxrnzgyal&gws_rd=ssl"); }
the html here:
<tr> <td> person home assignments? </td> <td class = "span1 tdtextaligncenter"> <img class='imageheight' src='http://m.com/en/images/common/green_check.png' /> </td> <td class = "span1 tdtextaligncenter"> </td> </tr>
try way.
webelement image = driver.findelement(by.xpath("//td/img[@src='http://m.com/en/images/common/green_check.png']")); if(image.isdisplayed()) { system.out.println("image present on page."); } else { system.out.println("image not present on page."); }
Comments
Post a Comment