我试图从配置了Maven的Jenkins运行Cucumber Selenium项目,但页面没有完全加载。 当我在错误之前拍摄浏览器的屏幕截图时,它显示窗口最大化未按预期工作,并且门户菜单未加载。
当我使用mvn test从命令提示符执行相同的项目时,执行按预期进行。
以下是Jenkins的控制台输出
T E S T S
-------------------------------------------------------
Running TestSuite
Feature: Portal Smoke Test
Nov 24, 2016 4:41:33 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 24, 2016 4:41:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Scenario: Validate Search page load [90m# PortalSearch.feature:3[0m
[32mGiven [0m[32mUser Navigates to "[0m[32m[1mhttps://URL/[0m[32m"[0m [90m# TestSteps.user_Navigates_to_home_page(String)[0m
[31mWhen [0m[31mUser Navigates to Search page[0m [90m# TestSteps.user_Navigates_to_Search_page()[0m
[31morg.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 5.08 seconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 18216a28-592a-4ed5-844a-087daf4ce854
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at insFrameWork.Base.click(Base.java:21)
at pageObjectFactory.LoginPage.Search_link(LoginPage.java:35)
at stepDefinition.TestSteps.user_Navigates_to_Search_page(TestSteps.java:96)
at ?.When User Navigates to Property Search page(PortalSearch.feature:6)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: driver.version: unknown
at <anonymous class>.fxdriver.preconditions.visible(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:10716)
at <anonymous class>.DelayedCommand.prototype.checkPreconditions_(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12688)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12705)
at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:720)
[0m
1 Scenarios ([31m1 failed[0m)
2 Steps ([31m1 failed[0m, [32m1 passed[0m)
0m11.334s
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 5.08 seconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 18216a28-592a-4ed5-844a-087daf4ce854
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at insFrameWork.Base.click(Base.java:21)
at pageObjectFactory.LoginPage.Search_link(LoginPage.java:35)
at stepDefinition.TestSteps.user_Navigates_to_Search_page(TestSteps.java:96)
at ?.When User Navigates to Property Search page(PortalSearch.feature:6)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: driver.version: unknown
at <anonymous class>.fxdriver.preconditions.visible(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:10716)
at <anonymous class>.DelayedCommand.prototype.checkPreconditions_(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12688)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12705)
at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:720)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 11.868 sec <<< FAILURE! - in TestSuite
run_cukes(cucumberTestDriver.TestRunner) Time elapsed: 11.555 sec <<< FAILURE!
cucumber.runtime.CucumberException: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 5.08 seconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 18216a28-592a-4ed5-844a-087daf4ce854
at cucumber.api.testng.TestNGCucumberRunner.runCukes(TestNGCucumberRunner.java:48)
at cucumber.api.testng.AbstractTestNGCucumberTests.run_cukes(AbstractTestNGCucumberTests.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
at cucumber.api.testng.AbstractTestNGCucumberTests.run(AbstractTestNGCucumberTests.java:19)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:689)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 5.08 seconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 18216a28-592a-4ed5-844a-087daf4ce854
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at insFrameWork.Base.click(Base.java:21)
at pageObjectFactory.LoginPage.PropertySearch_link(LoginPage.java:35)
at stepDefinition.TestSteps.user_Navigates_to_Search_page(TestSteps.java:96)
at ?.When User Navigates to Search page(PortalSearch.feature:6)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-UA1TDDQKTL6', ip: '172.31.1.205', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: driver.version: unknown
at <anonymous class>.fxdriver.preconditions.visible(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:10716)
at <anonymous class>.DelayedCommand.prototype.checkPreconditions_(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12688)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12705)
at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Windows/TEMP/anonymous1543057323057113866webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:720)
Results :
Failed tests:
TestRunner>AbstractTestNGCucumberTests.run:19->AbstractTestNGCucumberTests.run_cukes:14 » Cucumber
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[ERROR] There are test failures.