0

以下のコードで入力要素を見つけようとしたとき

driver.findElement(By.cssSelector("input[name=\"passengers[0].passengerName\"]")).sendKeys("xxxxxxxxxxxxxx");

セレンは次のエラーをスローしました..

org.openqa.selenium.WebDriverException: b.addEventListener is not a function
Command duration or timeout: 16 milliseconds
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:45'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.38-13-generic', java.version: '1.6.0_24'
Session ID: e713ccdc-dc05-40a1-923a-8ee51cfa525b
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=16.0.2, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:302)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:379)
        at org.openqa.selenium.By$ByCssSelector.findElement(By.java:407)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:294)
        at irctcticketbooking.Main.main(Main.java:119)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: b.addEventListener is not a function
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:45'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.38-13-generic', java.version: '1.6.0_24'
Driver info: driver.version: unknown
        at <anonymous class>.<anonymous method>(resource://fxdriver/modules/web_element_cache.js:7185)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:6821)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8245)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8260)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10222)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10227)
        at <anonymous class>.<anonymous method>(file:///tmp/anonymous8377906034759035727webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10167)

要素ID、名前、CSS、およびxpathを試しました。この例外を取り除くのに何の助けにもなりませんでした。

ソース HTML ファイル : https://dl.dropbox.com/u/345966710/A.html テスト Java コード : https://dl.dropbox.com/u/345966710/Test.java

4

2 に答える 2

0

findElementByName("passengers[0].passengerName").sendKeys("P1") 私のために働く

ff 16 で Java Webdriver 2.25 を使用 - Windows

2.28でも試しました。

于 2013-02-04T14:26:53.667 に答える
0

このようなことを試してください

driver.findElement(By.cssSelector("[name*='0'][name*='passengerName']")).sendKeys("test");
于 2013-02-08T13:17:19.017 に答える