我需要一個Selenium/java測試,點擊複選框,在頁面上顯示所有消息的高位,然後單擊刪除,然後我需要測試重複這些操作。所有發生在gmail.com。從gmail收件箱中刪除郵件失敗
這裏是我的代碼:
for(int s = 0; s <= 10 ; s++) {
driver.findElement(By.cssSelector(".T-Jo-auh")).click();
driver.findElement(By.cssSelector(".ar9.T-I-J3.J-J5-Ji")).click();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
和其他版本:
for(int s = 0; s <= 10 ; s++) {
driver.findElement(By.cssSelector("div.T-Jo-auh")).click();
driver.findElement(By.xpath("//div[@id=':5']/div/div/div/div/div/div[2]/div[3]/div/div")).click();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
這段代碼的問題是,硒做最多的事情4次,然後崩潰即使for
有許多工作要做10倍。
任何暗示,傢伙?
編輯:這是我從日食
temp
temporary.temp
testSzkielet(temporary.temp)
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 20.17 seconds
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'ASUS-HT-2', ip: '10.15.0.127', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_75'
Session ID: 5a7994fa-a8ac-464a-9223-ffb325cf12fa
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=38.0.1}]
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:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
at temporary.temp.testSzkielet(temp.java:48)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'ASUS-HT-2', ip: '10.15.0.127', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_75'
Driver info: driver.version: unknown
at <anonymous class>.fxdriver.preconditions.visible(file:///C:/Users/KKUCZ_~1/AppData/Local/Temp/anonymous5326946533230625964webdriver-profile/extensions/[email protected]/components/command-processor.js:9587)
at <anonymous class>.DelayedCommand.prototype.checkPreconditions_(file:///C:/Users/KKUCZ_~1/AppData/Local/Temp/anonymous5326946533230625964webdriver-profile/extensions/[email protected]/components/command-processor.js:12257)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/KKUCZ_~1/AppData/Local/Temp/anonymous5326946533230625964webdriver-profile/extensions/[email protected]/components/command-processor.js:12274)
at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/KKUCZ_~1/AppData/Local/Temp/anonymous5326946533230625964webdriver-profile/extensions/[email protected]/components/command-processor.js:603)
stacktrace please? –