【问题标题】:FirefoxDriver - selenium and XULFirefoxDriver - 硒和 XUL
【发布时间】:2011-04-15 18:33:20
【问题描述】:

我有一个用 XUL 编写的 Web 应用程序,我一直在尝试使用 FireFoxDriver 与浏览器进行交互。我可以找到一个元素,但是当我使用 sendKeys 或单击它时,它不会触发任何事件。这是我的代码

 <rows>
                        <row>
                            <spacer height="10"/>
                        </row>
                        <row>
                            <label class="LoginLabels" control="login" value="&LOGIN_LABEL;"/>
                            <textbox id="login" onkeypress="doKey(event)" onclick="return false;"
                                     ondblclick="return false;" persist="value" context="nocontext"/>
                        </row>
                        <row>
                            <spacer height="5"/>
                        </row>
                        <row>
                            <label class="LoginLabels" control="pass" value="&LOGIN_PASSWORD_LABEL;"/>
                            <textbox id="password" type="password" onkeypress="doKey(event)" onclick="return false;"
                                     ondblclick="return false;" context="nocontext"/>
                        </row>
                        <row>
                            <spacer height="5"/>
                        </row>
                    </rows>

我正在像这样使用 Selenium 的 FireFoxDriver

driver = new FirefoxDriver(mFirefoxProfile);
driver.get("/login.xul");
driver.findElement(By.id("login")).sendKeys('username');
driver.findElement(By.id("go")).click();

这是错误,我明白了

org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with

系统信息:os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_23' 驱动程序信息:driver.version:RemoteWebDriver 原因:org.openqa.selenium.remote.ErrorHandler$UnknownServerException:元素当前不可见,因此可能无法与之交互 系统信息:os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.6.0_23' 驱动程序信息:驱动程序版本:未知 在 .WebDriverError(file:///C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/fxdriver@googlecode.com/resource/modules/atoms.js:8435) 在 .(file:///C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/fxdriver@googlecode.com/resource/modules/atoms.js:9366)

【问题讨论】:

    标签: xul webdriver selenium-webdriver


    【解决方案1】:

    说实话,Selenium 并不是您想要测试这些类型的应用程序的工具。

    我建议使用Mozmill,它是测试插件的好工具,桌面自动化团队也使用它来自动化 Firefox 测试。它能够连接到浏览器的 chrome 等等。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-04
    • 1970-01-01
    • 1970-01-01
    • 2021-08-24
    • 1970-01-01
    • 1970-01-01
    • 2021-05-06
    • 1970-01-01
    相关资源
    最近更新 更多