我已经使用cucumber开发了一个测试框架,并且我正在使用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作业时同样不起作用,抛出相同的上述异常。
发布于 2016-09-13 14:01:48
你的问题是对象是不可见的,因此不能与之交互。
不幸的是,很难说为什么。我将通过以Jenkins在tat主机上运行的相同用户身份运行测试来开始我的故障排除。当你这样做的时候,可能会有一些显而易见的事情。
https://stackoverflow.com/questions/39444416
复制相似问题