FirefoxDriver - selenium and XUL

泪湿孤枕 提交于 2019-12-13 06:33:42

问题


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>

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();

and here is the error, I get

org.openqa.selenium.ElementNotVisibleException: 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: 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)


回答1:


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

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.



来源:https://stackoverflow.com/questions/5680917/firefoxdriver-selenium-and-xul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!