我已经开发了一个使用黄瓜的测试框架,并且我使用WebDriver中的Actions类来执行一些鼠标移动和点击操作,当我在eclipse上运行我的框架(Runas-> Junit)时,它按预期工作,同样我也在jenkins创建了一份工作,当我开始工作时,这个功能并没有按预期工作。它抛出错误" openqa.selenium.ElementNotVisibleException"
以下是我的代码: -
@FindBy(how = How.CSS, using = ".poster>img")
public static WebElement image;
public void Trailor() throws InterruptedException{
Actions action=new Actions(driver);
action.moveToElement(image).perform();
Thread.sleep(2000);
Jenkins Exception:-
T E S T S
-------------------------------------------------------
Feature: Test PVRCinemas.com NOW SHOWING Functionality
Running Scenario: NOW SHOWING Flow
Sep 13, 2016 12:04:02 PM org.bridj.BridJ log
INFO: Registering type org.sikuli.util.SysJNA$WinKernel32
Sep 13, 2016 12:04:02 PM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT$timeval_customizer
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.StructIO$DefaultCustomizer
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.TimeT$timeval
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.StructObject
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.NativeObject
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type org.bridj.AbstractIntegral
Sep 13, 2016 12:04:03 PM org.bridj.BridJ log
INFO: Registering type java.lang.Number
[error] Location: outside any screen (26136544, 0) - subsequent actions might not work as expected
[error] Location: outside any screen (26136768, 0) - subsequent actions might not work as expected
[error] Location: outside any screen (26136768, 0) - subsequent actions might not work as expected
[error] Location: outside any screen (26136384, 0) - subsequent actions might not work as expected
[error] RobotDesktop: checkMousePosition: should be L(26136768,0)
but after move is L(26136384,0)
Possible cause in case you did not touch the mouse while script was running:
Mouse actions are blocked generally or by the frontmost application.
You might try to run the SikuliX stuff as admin.
share location browser pop up not found
click on Now Showing tab
Background: [90m# J_NowShowing.feature:3[0m
[32mWhen [0m[32mNavigate to PVRCinemas.com and share location[0m [90m# Cinemas.navigate_to_PVRCinemas_com_and_share_location()[0m
[32mThen [0m[32mclick on Now Showing tab[0m [90m# NowShowing.click_on_Now_Showing_tab()[0m
Get all the movie count of movies which are visible
prior displayed false
prior enabled true
after displayed false
after enabled true
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 149.629 sec <<< FAILURE! - in Scenario: NOW SHOWING Flow
Then Click on Trailor of movie(Scenario: NOW SHOWING Flow) Time elapsed: 0.043 sec <<< ERROR!
org.openqa.selenium.ElementNotVisibleException:
Element is not currently visible and so may not be interacted with
Command duration or timeout: 20.15 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'HT', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_55'
Session ID: 3c8dbc9c-514d-4da8-8616-bd61431b6fbb
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=44.0.2}]
Caused by: org.openqa.selenium.ElementNotVisibleException:
Element is not currently visible and so may not be interacted with
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'HT', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_55'
Driver info: driver.version: unknown
Running Scenario: NOW SHOWING Flow
[34mCurrent Page URL is http://www.pvrcinemas.com/[0m
Scenario: NOW SHOWING Flow [90m# J_NowShowing.feature:7[0m
[32mGiven [0m[32mGet all the movie count of movies which are visible[0m [90m# NowShowing.get_all_the_movie_count_of_movies_which_are_visible()[0m
[31mThen [0m[31mClick on Trailor of movie[0m [90m# NowShowing.click_on_Trailor_of_movie()[0m
[31morg.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 20.15 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'HT', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_55'
Session ID: 3c8dbc9c-514d-4da8-8616-bd61431b6fbb
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=44.0.2}]
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:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:51)
at com.sun.proxy.$Proxy21.click(Unknown Source)
at pageObject.NowShowingPage.Trailor(NowShowingPage.java:100)
at stepdefinitions.NowShowing.click_on_Trailor_of_movie(NowShowing.java:35)
at ?.Then Click on Trailor of movie(J_NowShowing.feature:9)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'HT', ip: '192.168.56.1', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_55'
Driver info: driver.version: unknown
请帮忙,我也尝试过隐式和明确的等待,但同样的工作并不是通过运行jenkins工作,抛出同样的异常。
答案 0 :(得分:0)
您的问题是该对象不可见,因此无法与之交互。
遗憾的是,很难说为什么。我会通过运行测试开始我的麻烦,因为同样的用户Jenkins在tat主机上运行。当你这样做时,也许会有一些明显的东西。