如何在执行旅程时在任何操作点处理MoveTargetOutOfBoundsException错误

时间:2017-07-11 04:57:57

标签: java selenium-webdriver geckodriver

我在步骤的任何一点都得到以下错误,它只是在点击按钮时随机出现。但是,当我在不同的功能文件中使用相同的操作时,它的工作正常。 请帮我解决这个例外。

cucumber.runtime.CucumberException: org.openqa.selenium.interactions.MoveTargetOutOfBoundsException

请查看以下错误跟踪:

"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Dmaven.multiModuleProjectDirectory=C:\TEST1\Automation\Automation "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\lib\idea_rt.jar=54237:C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.1.5 test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building TEST1 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-chrome-driver/maven-metadata.xml
[WARNING] Could not transfer metadata org.seleniumhq.selenium:selenium-chrome-driver/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
[WARNING] Failure to transfer org.seleniumhq.selenium:selenium-chrome-driver/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.seleniumhq.selenium:selenium-chrome-driver/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
Downloading: https://repo.maven.apache.org/maven2/com/comcast/zucchini/zucchini/maven-metadata.xml
[WARNING] Could not transfer metadata com.comcast.zucchini:zucchini/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
[WARNING] Failure to transfer com.comcast.zucchini:zucchini/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata com.comcast.zucchini:zucchini/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
Downloading: https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-java/maven-metadata.xml
[WARNING] Could not transfer metadata org.seleniumhq.selenium:selenium-java/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
[WARNING] Failure to transfer org.seleniumhq.selenium:selenium-java/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.seleniumhq.selenium:selenium-java/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
Downloading: https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-api/maven-metadata.xml
[WARNING] Could not transfer metadata org.seleniumhq.selenium:selenium-api/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
Downloading: https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-support/maven-metadata.xml
[WARNING] Could not transfer metadata org.seleniumhq.selenium:selenium-support/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
Downloading: https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-firefox-driver/maven-metadata.xml
[WARNING] Could not transfer metadata org.seleniumhq.selenium:selenium-firefox-driver/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
[WARNING] Failure to transfer org.seleniumhq.selenium:selenium-firefox-driver/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.seleniumhq.selenium:selenium-firefox-driver/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Unrecognized SSL message, plaintext connection?
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TEST1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 13 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:compile (default-compile) @ TEST1 ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 161 source files to C:\TEST1\Automation\Automation\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ TEST1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 216 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:testCompile (default-testCompile) @ TEST1 ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\TEST1\Automation\Automation\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ TEST1 ---
[INFO] Surefire report directory: C:\TEST1\Automation\Automation\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.TEST1.Runner.AbstractStepDefinitionTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@3cd1f1c8
1499747367861   geckodriver INFO    Listening on 127.0.0.1:12575
1499747369189   geckodriver::marionette INFO    Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
1499747396350   Marionette  INFO    Listening on port 54257
Jul 11, 2017 9:59:59 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
10:00:00.152 [Firefox] DEBUG c.c.zucchini.AbstractZucchiniTest - ZucchiniTest[Firefox] starting
10:00:01.834 [Firefox] DEBUG c.c.zucchini.AbstractZucchiniTest - Setup method was not implemented for AbstractStepDefinitionTest
10:00:01.838 [Firefox] DEBUG c.c.zucchini.AbstractZucchiniTest - Setup formatter method was not implemented for AbstractStepDefinitionTestPayment Method Change

Failed scenarios:
Test1.feature:5 # Scenario:ABC
1 Scenarios (1 failed)
31 Steps (1 failed, 27 skipped, 3 passed)
0m29.212s

org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: (754.5, 1197.86669921875) is out of bounds of viewport width (1366) and height (659)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'P4A-508SC85', ip: '10.252.61.33', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\AppData\Local\Temp\rust_mozprofile.ReEPzGYkifDr, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0.1, platformVersion=10.0, moz:processID=2192.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: 984ad7a7-d93e-48ea-a6ce-728c64bebcac
    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:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:703)
    com.StartNewTest.userClicksStartNewTestButton(JourneySelectPage.java:99)
    at ?.And User Clicks Start New Test Button(Test1.feature:9)
10:00:33.255 [Firefox] ERROR c.c.zucchini.AbstractZucchiniTest - ERROR running test:
cucumber.runtime.CucumberException: org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: (754.5, 1197.86669921875) is out of bounds of viewport width (1366) and height (659)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'P4A-508SC85', ip: '10.252.61.33', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\AppData\Local\Temp\rust_mozprofile.ReEPzGYkifDr, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0.1, platformVersion=10.0, moz:processID=2192.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: 984ad7a7-d93e-48ea-a6ce-728c64bebcac
    at com.comcast.zucchini.TestNGZucchiniRunner.runCukes(TestNGZucchiniRunner.java:80) ~[zucchini-2.2.9.jar:2.2.9]
    at com.comcast.zucchini.AbstractZucchiniTest.runWith(AbstractZucchiniTest.java:255) ~[zucchini-2.2.9.jar:2.2.9]
    at com.comcast.zucchini.TestRunner.run(TestRunner.java:51) [zucchini-2.2.9.jar:2.2.9]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: (754.5, 1197.86669921875) is out of bounds of viewport width (1366) and height (659)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'P4A-508SC85', ip: '10.252.61.33', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\AppData\Local\Temp\rust_mozprofile.ReEPzGYkifDr, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0.1, platformVersion=10.0, moz:processID=2192.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: 984ad7a7-d93e-48ea-a6ce-728c64bebcac

在特定步骤中没有给出错误:

WebElement StartNewQuoteButton = ElementFunctions.FindElementWithinDriver(MQStartNewTestObjects,
                Locators.StartNewTestButton.toString(), driver);
        Actions NewQuoteButton = new Actions(driver);
        NewQuoteButton.moveToElement(StartNewTestButton).click().perform();

而且,它也在这里给出同样的错误:

List<WebElement> ContinueButton = ElementFunctions.FindElementsWithinDriver(TestPageObjects,
                Locators.ContinueButton.toString(), driver);
        // Click Button
        ElementActions.ClickButton(ContinueButton);

0 个答案:

没有答案