exception ...组件返回失败代码0x804b000a - Selenium WebDriver

时间:2014-02-03 04:04:07

标签: java eclipse firefox selenium selenium-webdriver

目前正在使用 Selenium WebDriver 并使用 Java 。在运行代码时遇到问题,它显示以下错误: org.openqa.selenium.InvalidElementStateException:[Exception ...“组件返回失败代码:0x80004005(NS_ERROR_FAILURE)[nsINativeMouse.click]”nsresult:“ 0x80004005(NS_ERROR_FAILURE)“location:”JS frame :: file:/// C:/DOCUME〜1 / amth/LOCALS〜1 / Temp / anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js: :WebElement.clickElement :: line 10257“data:no] 命令持续时间或超时:187毫秒

这是Java代码:

Log.info("Clicking on Visualization dropdown");
JavascriptExecutor executor18 = (JavascriptExecutor)driver;
executor18.executeScript("document.getElementById('visualizationId').style.display='block';");
Select select18 = new Select(driver.findElement(By.id("visualizationId")));
select18.selectByVisibleText("RD Tech Group");
Thread.sleep(6000);

Log.info("Clicking on Period dropdown");
JavascriptExecutor executor19 = (JavascriptExecutor)driver;
executor19.executeScript("document.getElementById('periodId').style.display='block';");
Select select19 = new Select(driver.findElement(By.id("periodId")));
select19.selectByVisibleText("Month Range");// Once this option selected in UI the drop down stopped
Thread.sleep(6000); 
Log.info("Clicking on fromMonth drop down");// Up to this line it is executing then is skipped out and showing error
driver.findElement(By.id("fromMonth")).click();
WebElement selectElement01 = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.className("ui-datepicker-year")));
Select select20 = new Select(selectElement01);
select20.selectByValue("2012");
Thread.sleep(6000);
WebElement dateWidget01 = driver.findElement(By.id("ui-monthpicker-div"));
List<WebElement> columns01=dateWidget01.findElements(By.tagName("td"));
for (WebElement cell: columns01){
//Select Feb Month
if (cell.getText().equals("Feb")){
cell.findElement(By.linkText("Feb")).click();
break;
}
} 
Log.info("Clicking on toMonth drop down");
WebElement selectElement02 = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.className("ui-datepicker-year")));
Select select21 = new Select(selectElement02);
select21.selectByValue("2012");
Thread.sleep(6000);
WebElement dateWidget02 = driver.findElement(By.id("ui-monthpicker-div"));
List<WebElement> columns02=dateWidget02.findElements(By.tagName("td"));
for (WebElement cell: columns02){
//Select March Month
if (cell.getText().equals("Mar")){
cell.findElement(By.linkText("Mar")).click();
break;
}
}
Log.info("Clicking on Apply Filter button");
driver.findElement(By.id("kpiFilterSubmit")).click();
Thread.sleep(10000);

以下是Stack跟踪:

[TestNG] Running:
C:\Documents and Settings\amth\Local Settings\Temp\testng-eclipse-2089590898\testng-customsuite.xml

FAILED: Login
org.openqa.selenium.InvalidElementStateException: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsINativeMouse.click]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js :: WebElement.clickElement :: line 10257"  data: no]
Command duration or timeout: 187 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'OAI1AMTH01', ip: '10.4.16.145', os.name: 'Windows XP', os.arch: 'amd64', os.version: '5.2', java.version: '1.7.0_51'
Session ID: bdb3cc8b-2907-4379-a4f4-e2181b33c6e4
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true,   cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=26.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
at test.OverviewAndEvolutionPR.performLogin(OverviewAndEvolutionPR.java:346)
at test.OverviewAndEvolutionPR.Login(OverviewAndEvolutionPR.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsINativeMouse.click]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js :: WebElement.clickElement :: line 10257"  data: no]
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'OAI1AMTH01', ip: '10.4.16.145', os.name: 'Windows XP', os.arch: 'amd64', os.version: '5.2', java.version: '1.7.0_51'
Driver info: driver.version: unknown
at <anonymous class>.WebElement.clickElement(file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10264)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10831)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10836)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/DOCUME~1/amth/LOCALS~1/Temp/anonymous1356356134669446179webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10778)


===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================

默认套件    总测试运行:1,失败:1,跳过:0     ===============================================

[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@7df86f75: 94 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@75115dab: 16 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@2e7f4425: 15 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@2eaafcb8: 32 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@5af8592: 15 ms

0 个答案:

没有答案