0
<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 the img take it opens a 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 it click it hangs there itself , no statements execute after that ..

Any help on this?

4

1 回答 1

0

0) 确保没有 AJAX 或其他异步内容发生。马克问了这个,但值得仔细检查。只需添加显式等待 img 元素,看看是否有帮助。(不,不要使用 Thread.Sleep() 或类似的东西。:))

1)将您的点击目标移动到锚标记。除非你有明确地连接到元素的东西,否则点击操作不会做任何事情。它是实际生成弹出窗口的元素。(您也可以在上面的 HTML 片段中看到!)

祝你好运!

于 2013-07-15T22:39:59.187 回答