首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WebDriver打开rich:popupPanel

WebDriver打开rich:popupPanel
EN

Stack Overflow用户
提问于 2013-05-06 21:31:55
回答 1查看 236关注 0票数 0

我们正在使用Selenium WebDriver测试一个应用程序。HTMLUnitDriver是我们的选择(因为非gui测试),有时IEDriver用于呈现目的。无论如何,我尝试单击一个按钮,这个按钮必须打开一个rich:popuPanel(modal=true)并单击该面板上的一个链接。对于IEDriver,这没有问题,但是对于HTMLUnitDriver,popupPanel不能打开。我试着用几种方法来执行这些点击:

代码语言:javascript
复制
    JavascriptExecutor jsdriver = (JavascriptExecutor) driver;
    jsdriver.executeScript("$('input[id$=freigabeCmd_id]').focus();");
    //below are the other tries
    // jsdriver.executeScript("$('input[id$=freigabeCmd_id]').click();");
    // jsdriver.executeScript("window.document.getElementById('editorViewForm_id:freigabeCmd_id').click()");
    // jsdriver.executeScript("arguments[0].click()", freigabeButton);
    // jsdriver.executeScript("arguments[0].fireEvent('onclick');", freigabeButton);

更进一步,我尝试了“正常的方式”:

代码语言:javascript
复制
        freigabeButton.click();
    //below are other ways i found here on stackoverflow
    // freigabeButton.sendKeys(Keys.ENTER);
    // new Actions(driver).moveToElement(freigabeButton).clickAndHold().release().build().perform();

但我并不想让popupPanel变得“可见”。有人知道为什么吗?!我现在真的卡住了。如果您需要更多的信息,请让我知道。

使用: HTMLUnit版本2.12和最新的SeleniumVersion

EN

回答 1

Stack Overflow用户

发布于 2013-05-07 19:26:01

可能是您的webapp使用javascript来启动丰富的弹出式面板,而您在运行HtmlUnitDriver时禁用了javascript?它是disabled by default,所以需要显式启用它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16399875

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档