webdriver click on img tag -


<td>     <a id="userid_popup" onclick="openlookupwinnew('/oasis/userlookup.do', 400, 270, 'userid_input', 'assigntouserid', 'uiassigntouserid', false)" name="userid_popup">         <img class="icon" title="users" alt="users" src="/oasis/images/search_button1.gif" style="background-color: transparent;">     </a>     <input id="hide" type="button" style="display: none"> </td> 

on clicking img take opens popup window

i tried following code, @findby(css = "#userid_popup>img") private webelement lookupbutton;

  1. lookupbutton.click() --> elementnotvisibleexception
  2. ((javascriptexecutor) driver).executescript("return arguments[0].click();", lookupbutton) --> even though click hangs there , no statements execute after ..

any on this?

0) ensure there's no ajax or other async stuff going on. mark asked that, it's worth double-checking. add in explicit wait img element , see if helps. (no, not use thread.sleep() or similar. :) )

1) move click target anchor tag. unless have wired explicitly element click action there isn't going anything. it's element spawns popup window. (which can see in html snippet above, too!)

good luck!


Comments