我已經寫在XUL的Web應用程序,我一直在嘗試使用FireFoxDriver與瀏覽器進行交互。我可以找到一個元素,但是當我使用sendKeys或點擊它不會觸發任何事件。這裏是我的代碼FirefoxDriver - 硒和XUL
<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:「視窗7' ,os.arch: 'AMD64',os.version: '6.1',java.version: '1.6.0_23' 驅動程序信息:driver.version:RemoteWebDriver 產生的原因:org.openqa.selenium.remote.ErrorHan dler $ UnknownServerException:元素當前不可見,所以可能不會 系統信息進行交互:os.name: 'Windows 7的',os.arch: 'AMD64',os.version: '6.1',java.version:「 1.6.0_23' 驅動程序信息:driver.version:unknown at .WebDriverError(file:/// C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/[email protected]/資源/模塊/ atoms.js:8435) 在(文件:/// C:/Users/POOYAN~1/AppData/Local/Temp/anonymous4952327108425051793webdriver-profile/extensions/[email protected]/resource/modules/ atoms.js:9366)
謝謝,indead它是我的情況下,選擇合適的框架... – user710351 2011-04-20 11:48:35
mozmill已被棄用,用木偶取代? https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette – jmunsch 2016-07-01 03:08:17