I am having a real hard time setting Selenium Grid. The configuration looks like this:
Hub - windows 7 machine
Chrome on windows node - same windows 7 machine
Firefox on windows node - same windows 7 machine
ie on windows node - same windows 7 machine
Chrome on Linux node - VM running inside same windows 7 machine
Firefox on Linux node - VM running inside same windows 7 machine
Chrome on mac node - mac mini
Firefox on mac node - same mac mini
Safari on mac node - same mac mini
Web app server - VM running inside same windows 7 machine
I have a 150 tests test suite and I am trying to run all tests on all nodes in parallel. Tests run on mac mini almost never come to the end. I am getting the same error message for all three browsers and it happens without any pattern. The error might occur during any of tests. It happens even if I am running tests only in one browser on the mac mini. The problem never occurs on windows or Linux nodes.
Error message:
org.openqa.selenium.WebDriverException: cannot forward the request Connect
to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
Command duration or timeout: 21.02 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'hub', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=38.0.5, platform=MAC, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=1f7a9512-5c5b-4f52-bcd9-ca4d8f351343, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 1f7a9512-5c5b-4f52-bcd9-ca4d8f351343
*** Element info: {Using=xpath, value=(//*[contains(concat(' ', normalize-space(#class), ' '), ' explorerWidget ')]//*[contains(concat(' ', normalize-space(#class), ' '), ' controlContentRow ')])[2]//a}
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: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.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invokeUnderlying(ThreadGuard.java:100)
at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invoke(ThreadGuard.java:92)
at com.sun.proxy.$Proxy9.findElement(Unknown Source)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:730)
at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:728)
at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:106)
at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
at com.altego.common.WebElements.getElementByXpath(WebElements.java:31)
at com.altego.webactions.View.setView(View.java:41)
at com.altego.tests.functional.DistributionViewTest.DDistributionMeasure(DistributionViewTest.java:172)
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:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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.grid.common.exception.GridException: cannot forward the request Connect to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:139)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)
I am not sure that makes much sense of putting code here since error could occur in any test, but I can leave my hubConfig.json and nodeConfig.json.
hubConfig.json
{
"host": null,
"port": 4444,
"newSessionWaitTimeout": 20000,
"servlets" : ["org.openqa.grid.web.servlets.ResourceServlet"],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 500000,
"timeout": 3000000,
"browserTimeout": 500000,
"maxSession": 10,
"jettyMaxThreads":-1
}
nodeConfig.json:
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 1
}
],
"configuration":
{
"nodeTimeout":600000,
"port":5555,
"nodePolling":5000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":200000,
"timeout":600000,
"maxSession":1
}
}
Another thing that might be useful, both machines are connected to router using wireless connection.
Thanks
Related
I have an eCommerce website where, when I try to place an Order where it redirects to a Paypal Page. When I Login as a Paypal user, it redirects to another checkout screen where I try to automate using selenium web driver.
At this step, I get the following exception (I tried to access the iframe by using Println method):
Chrome Version Version 64.0.3282.140 (Official Build) (64-bit)
Selenium Server Standalone jar:3.9.1
[TestNG] Running:
C:\Users\MVN020\AppData\Local\Temp\testng-eclipse--1759291335\testng-customsuite.xml
Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 39463
Only local connections are allowed.
size3
size3
size1
FAILED: f
org.openqa.selenium.NoSuchFrameException: no such frame
(Session info: chrome=64.0.3282.140)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'GOKAL', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40'
Session ID: 4b02279f3819eced46aa69a5c4f37004
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\MVN020\AppData\Local\Temp\scoped_dir12284_24522, chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f)}, networkConnectionEnabled=false, unexpectedAlertBehaviour=, rotatable=false, setWindowRect=true, locationContextEnabled=true, mobileEmulationEnabled=false, version=64.0.3282.140, pageLoadStrategy=normal, takesHeapSnapshot=true, databaseEnabled=false, cssSelectorsEnabled=true, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
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:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:857)
at automationFramework.CodePaypal.f(CodePaypal.java:86)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter#143f45a8: 22 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter#7595edfe: 8 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 5 ms
[TestNG] Time taken by org.testng.reporters.jq.Main#1b814a5: 25 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2#7aee64f1: 4 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter#3ed9a7a6: 15 ms
In this situations problem might be one of the two below reasons.
1.If its redirecting to new window and without switching to new window you cannot access any locator of new window. You can use the below code to switch window
String Parent_Window = driver.getWindowHandle();
//Get Parent window handle befor child window opens
String winHandleBefore = _driver.getWindowHandle();
for (String winHandle : _driver.getWindowHandles()) {
// Switch to child window
if( Parent_Window != winHandle )
driver.switchTo().window(winHandle);
}
Perform the action in child window and switch back to parent window.
If it is not redirecting to new window and your locator is correct then the problem might be that , frame you are looking for is the child of some other frame. In that case you may have to switch to parent frame first and then to child frame.
Hope this will work.
I am running automation on android real devices. The automation works successfully across devices which has version less than 7. But when I try to run automation on devices which has version greater than 7(Redmi-note4, Redmi 4), I am getting a below error.
[TestNG] Running:
C:\Users\sandeepraju\AppData\Local\Temp\testng-eclipse-819864143\testng-customsuite.xml
FAILED: newRegistrationIn
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\sandeepraju\AppData\Local\Android\sdk1\platform-tools\adb.exe shell "stop; sleep 2; setprop sys.boot_completed 0; start""
stop: must be root
start: must be root
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9.96 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'SandeepDell', ip: '192.168.234.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: io.appium.java_client.android.AndroidDriver
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:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:39)
at com.gdi.basemodule.LaunchApp.launchApplication(LaunchApp.java:51)
at com.gdi.modules.Modules.newRegistrationIn(Modules.java:34)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
Please refer the below code.
public AndroidDriver launchApplication(String appName,ExtentTest testReport) throws MalformedURLException, InterruptedException
{
DesiredCapabilities cap= new DesiredCapabilities();
File appDir=new File("apps");
File app= new File(appDir,appName);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"6.0.1");
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Redmi4");
AndroidDriver androidDriver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),cap);
System.out.println(androidDriver);
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100");
androidDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
testReport.log(LogStatus.INFO, "Launch application");
if(androidDriver!=null)
{
testReport.log(LogStatus.PASS, "Successfully launched the application");
}
}
Please help me to run my automation android real devices 7.0
Update your Appium. The problem was well-known for quite some time, but they apparently finally fixed it not too long ago. I had the same problem and had to restrict all my tests to API's < 7 but now it runs on all API's without any code changes.
I didn't have this problem before my computer was updated from Windows 7 to Windows 10.
When I try to run my nightwatch test with firefox I get this error:
Running: Sending, Watching, and Sharing a Demo
INFO Request: POST /wd/hub/session
- data: {"desiredCapabilities":{"browserName":"firefox","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","name":"Complete\\sales\\sales Test1"}}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":151}
ERROR Response 500 POST /wd/hub/session (3319ms) { state: 'unhandled error',
sessionId: null,
hCode: 33496070,
value:
{ localizedMessage: '127.0.0.1:7055 failed to respond',
cause: null,
suppressed: [],
message: '127.0.0.1:7055 failed to respond',
hCode: 10341065,
class: 'org.apache.http.NoHttpResponseException',
screen: null },
class: 'org.openqa.selenium.remote.Response',
status: 13 }
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ state: 'unhandled error',
sessionId: null,
hCode: 33496070,
value:
{ localizedMessage: '127.0.0.1:7055 failed to respond',
cause: null,
suppressed: [],
message: '127.0.0.1:7055 failed to respond',
hCode: 10341065,
class: 'org.apache.http.NoHttpResponseException',
screen: null },
class: 'org.openqa.selenium.remote.Response',
status: 13 }
My selenium debug log lists:
11:08:52.724 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to bin/chromedriver
11:08:52.786 INFO - Java: Oracle Corporation 25.91-b15
11:08:52.786 INFO - OS: Windows 10 10.0 x86
11:08:52.802 INFO - v2.51.0, with Core v2.51.0. Built from revision 1af067d
11:08:52.849 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:08:52.849 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:08:52.849 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
11:08:52.948 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:08:52.948 INFO - Selenium Server is up and running
11:08:53.427 INFO - Executing: [new session: Capabilities [{acceptSslCerts=true, name=Complete\sales\sales Test1, browserName=firefox, javascriptEnabled=true, platform=ANY}]])
11:08:53.437 INFO - Creating a new session for Capabilities [{acceptSslCerts=true, name=Complete\sales\sales Test1, browserName=firefox, javascriptEnabled=true, platform=ANY}]
11:08:56.532 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'
System info: host: 'StudioXPS', ip: '10.0.0.46', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:202)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:164)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'
System info: host: 'StudioXPS', ip: '10.0.0.46', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:101)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
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.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91)
... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'
System info: host: 'StudioXPS', ip: '10.0.0.46', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
... 14 more
Caused by: org.apache.http.NoHttpResponseException: 127.0.0.1:7055 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:162)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:90)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:160)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:380)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 19 more
11:08:56.548 WARN - Exception: 127.0.0.1:7055 failed to respond
I have tried running the test through selenium standalone versions:
2.53.0
2.52.0
2.51.0
And since the latest firefox version (47.0.1) might not work, I've also tried with 46.0.1.
None of these have fixed the issue. Is there some way to fix this, or will I need to go back to windows 7?
I had the same error and by adding:
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
},
to the test_settings made my build worked
I have set up a small test suite with geb, everything is working fine with chrome and firefox, but now i wanted to extend the browsers i execute the tests on with IE and the tests always fail because of remaining cookies from previous tests (I'm still logged in after executing the login test)
To load the IEDriver i use the webdrivermanager from bonigarcia which executes Version 2.53.1.0 of InternetExplorerDriver.
Snippet from my GebConfig:
environments {
ie {
InternetExplorerDriverManager.getInstance().setup(Architecture.x32)
driver = { new InternetExplorerDriver() }
}
My test setup looks like this:
def setup() {
resetBrowser()
Database.resetDatabase()
}
The method resetBrowser() is from Geb and does this:
void resetBrowser() {
if (_browser?.config?.autoClearCookies) {
_browser.clearCookiesQuietly()
}
_browser = null
}
And here's my cleanup (also tried it without it, didn't change anything):
def cleanup() {
CachingDriverFactory.clearCacheAndQuitDriver()
}
resetBrowser() should delete the cookies, but I read, that only cookies from the current domain will be deleted. So I thought adding something like browser.clearCookies(browser.baseUrl) or browser.clearCookies("http://localhost:8080/") before, after or instead of resetBrowser() should work. But as soon as I add this line, the IEDriver stops working with the following exception (same exception is thrown when i use driver.manage().deleteAllCookies()):
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'MiiKEs', ip: '192.168.0.123', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_66'
Driver info: driver.version: RemoteWebDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:21317/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 75c52825-b9e6-4876-a1f9-454b450b839e
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions.deleteAllCookies(RemoteWebDriver.java:773)
at TestSpec.register test(TestSpec.groovy:84)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:21317 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'MiiKEs', ip: '192.168.0.123', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_66'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 3 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:21317 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:144)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:90)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 4 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 17 more
My Problem was not, that the cookies are not deleted, it was that LocalStorage is not cleaned!
To clean LocalStorage Geb doesn't offer any functionality yet, but this can be achieved with the following method which can be called in the setup() routine:
def clearLocalStorage() {
//first navigate to any page within the domain to which you want to clear the LocalStorage
// baseUrl can be set in
go(browser.baseUrl)
js.exec("localStorage.clear()") // and then just clear it
}
The suggestion to use the WebStorage interface of WebDriver is as far as I anderstood not possible till InternetExplorerDriver does not implement this interface!
public class FirstTest { WebDriver driver; #Test public void test() { System.setProperty("webdriver.ie.driver","C:\\Users\\Priyanka\\Documents\\datadriver\\IEDriverServer.exe"); driver=new InternetExplorerDriver(); //driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.get("http://gmail.com"); driver.findElement(By.id("userid")).sendKeys("Abc#gmail.coms"); driver.findElement(By.id("pwd")).sendKeys("abc#167"); driver.findElement(By.name("Submit")).click(); } }
This is my code.It will open the given URL but thows an error when trying to find webelement Error message:
FAILED: test org.openqa.selenium.NoSuchWindowException: Unable to find
element on closed window (WARNING: The server did not provide any
stacktrace information) Command duration or timeout: 28 milliseconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09
19:55:52' System info: host: 'Priyanka-PC', ip: '100.74.201.94',
os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',
java.version: '1.7.0_79' *** Element info: {Using=id, value=userid}
Session ID: fc075a9b-5a50-42fa-ba96-ce2258254d4a Driver info:
org.openqa.selenium.ie.InternetExplorerDriver Capabilities
[{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0,
ignoreZoomSetting=false, enablePersistentHover=true,
ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss,
version=-1, pageLoadStrategy=normal, ie.usePerProcessProxy=false,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false,
requireWindowFocus=false, initialBrowserUrl=http://localhost:22334/,
handlesAlerts=true, ie.forceCreateProcessApi=false, nativeEvents=true,
browserAttachTimeout=0, ie.browserCommandLineSwitches=,
takesScreenshot=true}] 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:647)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:403)
at org.openqa.selenium.By$ById.findElement(By.java:218) at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345)
at demo.FirstTest.test(FirstTest.java:20) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782) at
org.testng.TestRunner.run(TestRunner.java:632) at
org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at
org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at
org.testng.SuiteRunner.run(SuiteRunner.java:268) at
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at
org.testng.TestNG.runSuitesSequentially(TestNG.java:1246) at
org.testng.TestNG.runSuitesLocally(TestNG.java:1171) at
org.testng.TestNG.run(TestNG.java:1066) at
org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113) at
org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206) at
org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
I have done below settings:
Set Security zone
Made entry in Registry file
Set environment variable
Set default zoom size to 100 Please guide what should i do.
This code is working fine in firefox
Try this.
Enable protected mode for all zones in IE browser. It should be checked for all zones.
It worked for me.