FirefoxDriver-硒和XUL [英] FirefoxDriver - selenium and XUL

查看:58
本文介绍了FirefoxDriver-硒和XUL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a web application written in XUL and I've been trying to use FireFoxDriver to interact with the browser. I can locate an element, but when I use the sendKeys or click it doesn't trigger any event. here are my code

 <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

and I am using Selenium's FireFoxDriver like this

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

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

System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_23' Driver info: driver.version: RemoteWebDriver Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Element is not currently visible and so may not be interacted with System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_23' Driver info: driver.version: unknown at .WebDriverError(file:///C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/fxdriver@googlecode.com/resource/modules/atoms.js:8435) at .(file:///C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/fxdriver@googlecode.com/resource/modules/atoms.js:9366)

推荐答案

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

To be honest, Selenium is not the tool that you want for testing these types of applications.

我建议您使用 Mozmill ,用于测试Addon的工具,并且由桌面自动化团队用于自动化Firefox测试.它具有挂钩到浏览器chrome以及您想要的内容的功能.

I would recommend using Mozmill, which is a great tool for testing Addon's and is also used by the Desktop Automation team for Automating Firefox Tests. It has the ability to hook into the browser chrome and so what you want.

这篇关于FirefoxDriver-硒和XUL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆