Protractor not working for Safari on windows 7 - safari

I am trying to run protractor e2e test cases on safari with windows 7. its throwing following error:
[10:27:59] I/local - Starting selenium standalone server...
[10:27:59] I/launcher - Running 1 instances of WebDriver
[10:28:00] I/local - Selenium standalone server started at http://10.1.69.133:65294/wd/hub
[10:28:01] E/launcher - The best matching driver provider org.openqa.selenium.edge.EdgeDriver can't create a new driver instance for Capabilities [{
ceptSslCerts=true, trustAllSSLCertificates=true, name=safari-tests, count=1, browserName=safari, directConnect=false, sharedTestFiles=true}]
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'DENXD7OShore41p', ip: '10.1.69.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: unknown
[10:28:01] E/launcher - WebDriverError: The best matching driver provider org.openqa.selenium.edge.EdgeDriver can't create a new driver instance for
apabilities [{acceptSslCerts=true, trustAllSSLCertificates=true, name=safari-tests, count=1, browserName=safari, directConnect=false, sharedTestFile
true}]
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'DENXD7OShore41p', ip: '10.1.69.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: unknown
at WebDriverError (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\error.js:27:5)
at Object.checkLegacyResponse (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\error.js:639:15)
at parseHttpResponse (c:\Git\operator\ui\node_modules\selenium-webdriver\http\index.js:538:13)
at client_.send.then.response (c:\Git\operator\ui\node_modules\selenium-webdriver\http\index.js:472:11)
at ManagedPromise.invokeCallback_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:2820:25)
at c:\Git\operator\ui\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (c:\Git\operator\ui\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Builder.build (c:\Git\operator\ui\node_modules\selenium-webdriver\builder.js:458:24)
at Local.DriverProvider.getNewDriver (c:\Git\operator\ui\node_modules\protractor\built\driverProviders\driverProvider.js:37:33)
at Runner.createBrowser (c:\Git\operator\ui\node_modules\protractor\built\runner.js:198:43)
at c:\Git\operator\ui\node_modules\protractor\built\runner.js:277:30
at _fulfilled (c:\Git\operator\ui\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (c:\Git\operator\ui\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (c:\Git\operator\ui\node_modules\q\q.js:796:13)
at c:\Git\operator\ui\node_modules\q\q.js:604:44
at runSingle (c:\Git\operator\ui\node_modules\q\q.js:137:13)
[10:28:01] E/launcher - Process exited with error code 199
Here is the code for my protractor.conf.js file. I made some changes in config after error, Like i added selenium address and removed acceptSslCerts=true, trustAllSSLCertificates=true but after that i am getting the same error.
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'safari',
name: 'safari-tests',
directConnect: false,
seleniumAddress: 'http://localhost:4444/wd/hub'
},
maxInstances: 1,
baseUrl: 'http://localhost:3000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
isVerbose : true,
includeStackTrace : true,
print: function() {}
},
useAllAngular2AppRoots: true,
onPrepare: function() {
require('ts-node').register({
project: 'e2e'
});
jasmine.getEnv().addReporter(new SpecReporter());
browser.ignoreSynchronization = true;
}
};
Does it require some other configuration to run it on Safari.

Safari for Windows was discontinued years ago and installing the old Safari 5 exe that's still around won't help you achieve anything useful regarding test automation.
So never download Safari from other that the official site else chances are you are getting a Trojan in it.
You can only test Safari using a Mac OSX or you can try Sauce Labs / BrowserStack / Testing Bot / other cloud test providers to test in browsers you don't have installed locally.

Related

Not able to run selenium test jar in ec2

I am new to selenium and by help of some blogs and videos and i made a java selenium test in eclipse which is running perfectly fine, but my goal is to run the file on an ec2. I exported the jar and tried to run it on a ubuntu VM, but it is not running and giving the error as mentioned below. Any help would be appreciated.
Microsoft Edge WebDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: chrome not reachable
Host info: host: 'ip-192-168-2-75', ip: '192.168.2.75'
Build info: version: '4.7.1', revision: 'c6795baf1a3'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1027-aws', java.version: '11.0.17'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:551)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:159)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:54)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:46)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:42)
at ui.SureSMSTest.main(SureSMSTest.java:36)

Unable to connect to a remote machine using RemoteWebdriver

As i am new to selenium WebDriver, Remote Webdriver and WebDriverManager, i have issues connecting from hub to the node. This is how my design looks like -
I have a code base which runs on linux based machines. Now, I go ahead and git clone the selenium repository on linux machine . I would want to establish that linux machine as a hub. So start the selenium Standalone server on the linux machine as below -
java -jar selenium-server-standalone-3.5.3.jar -role hub
Now i have Windows based machines which i communicate using Remote Desktop Connection application
and i consider them as nodes and on one of the windows based machine i start the selenium standalone server as a node like below -
java -jar selenium-server-standalone-3.5.3.jar -role node -hub http://<public ip of linux hub machine>:4444/grid/register/
For both i get the successful connection
Linux Machine -
Windows Machine -
I try to execute below code -
#Test
public void test() throws MalformedURLException
{
System.out.println("Sample Test");
String s1 = System.getProperty("user");
String s2 = System.getProperty("pass");
System.out.println(s1);
System.out.println(s2);
System.out.println("++++++++++++++++++SETTING UP OPTIONS+++++++++++++");
//FirefoxOptions options = new FirefoxOptions();
ChromeOptions options = new ChromeOptions();
options.addArguments("--allow-insecure-localhost");
options.addArguments("--start-maximized");
options.addArguments("--no-sandbox");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--allow-running-insecure-content");
options.setAcceptInsecureCerts(true);
WebDriver driver = new RemoteWebDriver(new URL("http://<IP_LINUXMACHINE>:4444/wd/hub"),options);
System.out.println("++++++++++++++++++SETTING UP WEBDRIVER +++++++++++++++++++++++++++");
//WebDriver driver = WebDriverManager.chromedriver().capabilities(options).remoteAddress("http://<IP_LINUXMACHINE:4444/wd/hub").create();
driver.get("https://google.com");
}
Below is the MVN command -
mvn -f pom.xml -pl FrontEndTestsRepo,SharedLibrariesRepo --am clean install test -DsuiteXmlFile=testsuite.xml -Duser=abc -Dpass=abc#12
I get below error -
brotli4j not in the classpath; Brotli support will be unavailable.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.31 sec <<< FAILURE! - in TestSuite
test(com.******.mc.tests.common.LoginTests) Time elapsed: 1.225 sec <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Unable to create new service: ChromeDriverService
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'JENKINS-WIN-S12', ip: '************', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_321'
Driver info: driver.version: unknown
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'uiUbuntu18-102-44-LinuxSlave', ip: '********', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-42-generic', java.version: '1.8.0_292'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-co...], extensions: []}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-co...], extensions: []}}}]
Capabilities {}
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
at com.*******.mc.tests.common.LoginTests.test(LoginTests.java:47)
Got below error on hub
Got a request to create a new session: Capabilities [{goog:chromeOptions={args=[--allow-insecure-localhost, --start-maximized, --no-sandbox, --ignore-certificate-errors, --allow-running-insecure-content], extensions=[]}, acceptInsecureCerts=true, browserName=chrome}]
11:48:59.308 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=chrome, maxInstances=5, platform=VISTA}

Getting SessionNotCreatedError when trying to run scripts from Jenkins pipeline

I am trying to run my protractor scripts on jenkins pipeline and getting the SessionNotCreatedError when it tries to access the Selenium address. When I run the same on local its working fine. Not sure what's going on.
Conf.js script
let domainName = util.domainName;
exports.config = {
seleniumAddress: 'http://selenium-hub:4444/wd/hub', //for testing in the pipeline
directConnect: false, // Set to true for local testing, or provide a link to a running selenium grid.
// specs: ['e2e/**/mailbox-test.js', 'e2e/**/email-dumps-test.js'],
specs: ['e2e/**/*-test.js'],
capabilities: {
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
w3c: false,
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--window-size=1200,1200',
'--disable-dev-shm-usage',
'--allow-insecure-localhost',
'--allow-running-insecure-content',
'--ignore_ssl',
'--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
],
},
},
allScriptsTimeout: 600000,
baseUrl: eaUrl,
framework: 'jasmine',
jasmineNodeOpts: {
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 600000,
stackTrace: false
},
Jenkins output error
[15:32:21] D/launcher - Protractor version: 5.4.2 10:31:59 [15:32:21]
D/launcher - Your base url for tests is
https://ea-webapp-int-raven.ocp-nonprod.ice.dhs.gov/ 10:31:59
[15:32:21] I/launcher - Running 1 instances of WebDriver 10:31:59
[15:32:21] I/hosted - Using the selenium server at
http://selenium-hub:4444/wd/hub 10:37:05 [15:37:21] E/launcher -
Could not start a new session. New session request timed out 10:37:05
Build info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05 System
info: host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux',
os.arch: 'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64',
java.version: '11.0.13' 10:37:05 Driver info: driver.version: unknown
10:37:05 [15:37:21] E/launcher - SessionNotCreatedError: Could not
start a new session. New session request timed out 10:37:05 Build
info: version: '4.1.2', revision: '9a5a329c5a' 10:37:05 System info:
host: 'eb3088c85a9d', ip: '172.17.0.2', os.name: 'Linux', os.arch:
'amd64', os.version: '3.10.0-1160.53.1.el7.x86_64', java.version:
'11.0.13' 10:37:05 Driver info: driver.version: unknown 10:37:05
at Object.throwDecodedError
(/app/test/node_modules/selenium-webdriver/lib/error.js:514:15)
10:37:05 at parseHttpResponse
(/app/test/node_modules/selenium-webdriver/lib/http.js:519:13)
10:37:05 at doSend.then.response
(/app/test/node_modules/selenium-webdriver/lib/http.js:441:30)
10:37:05 at process._tickCallback
(internal/process/next_tick.js:68:7) 10:37:05 From: Task:
WebDriver.createSession() 10:37:05 at Function.createSession
(/app/test/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
10:37:05 at Function.createSession
(/app/test/node_modules/selenium-webdriver/chrome.js:761:15) 10:37:05
at createDriver
(/app/test/node_modules/selenium-webdriver/index.js:170:33) 10:37:05
at Builder.build
(/app/test/node_modules/selenium-webdriver/index.js:626:16) 10:37:05
at Hosted.getNewDriver
(/app/test/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
10:37:05 at Runner.createBrowser
(/app/test/node_modules/protractor/built/runner.js:195:43) 10:37:05
at q.then.then
(/app/test/node_modules/protractor/built/runner.js:339:29) 10:37:05
at _fulfilled (/app/test/node_modules/q/q.js:834:54) 10:37:05 at
/app/test/node_modules/q/q.js:863:30 10:37:05 at
Promise.promise.promiseDispatch (/app/test/node_modules/q/q.js:796:13)
10:37:05 [15:37:21] E/launcher - Process exited with error code 199
10:37:05 10:37:05 exitStatus=$? 10:37:05 10:37:05 # Allow the
Jenkin pipeline to access and archive any test output. 10:37:05 chmod
-R 777 ./test_output/
I am adding my observations as others might need if they get similar issues and this might help them too. After a long long investigation of the console output in Jenkins with my docker installation scripts, I noticed that we are trying to install the latest version of the selenium hub and chrome node but the docker command doesn't include the SE_EVENT_BUS_HOST information. After changing my code from
docker run -d --name selenium-node-chrome -e HUB_HOST=selenium-hub --shm-size="2g" nexus2.xxx.com:18443/selenium/node-chrome
to
docker run -d --name selenium-node-chrome -e SE_EVENT_BUS_HOST=selenium-hub --shm-size="2g" -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 nexus2.xxx.com:18443/selenium/node-chrome
Then it started working for me.

Getting "org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to" connecting hub with node

OS: Linux
Selenium Version:**3.12
**Browser: Chrome V66,
chromedriver 2.38
Following is my Grid configuration:
Hub(Linux) runs on Jenkins machine(https://jenkins.us.abc.edu) with Selenium Grid Jenkins plugin.
Now i am trying to register my Node with json like below and starting Node:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
node.json
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
**"port": 17946,**
"register": true,
"registerCycle": 5000,
**"hub": "http://jenkins.us.abc.edu:4444",**
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Following is Node console:
[uanem#usv-selapp-01 ~]$ java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
09:37:49.054 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
09:37:49.059 INFO [GridLauncherV3$3.launch] - Launching a Selenium Grid node on port 17946
2018-05-28 09:37:49.175:INFO::main: Logging initialized #490ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:37:49.324 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 17946
09:37:49.324 INFO [GridLauncherV3$3.launch] - Selenium Grid node is up and ready to register to the hub
09:37:49.332 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
09:37:49.332 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:37:50.866 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:37:50.965 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:37:50.965 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:39:11.333 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:39:11.392 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:39:11.404 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:39:11.405 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:40:31.602 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:40:31.632 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:40:31.642 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:40:31.642 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
09:41:51.809 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://jenkins.us.umuc.edu:4444/grid/register
09:41:51.850 INFO [SelfRegisteringRemote.registerToHub] - Updating the node configuration from the hub
09:41:51.856 WARN [SelfRegisteringRemote.registerToHub] - error getting the parameters from the hub. The node may end up with wrong timeouts.hudson.plugins.selenium.JenkinsCapabilityMatcher could not be coerced to instance
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'usv-selapp-01.us.umuc.edu', ip: '10.190.33.90', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.el7.x86_64', java.version: '1.8.0_144'
Driver info: driver.version: unknown
09:41:51.856 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
Here i could see the node is connected hub in my Jenkins Selenium Grid page at "10.190.33.90"
Following is my sample script:
#Test
public void GoogleTest() throws Exception
{
System.out.println("I am in test");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
System.out.println("I am after setting chromedriver path ");
**remoteWD = new RemoteWebDriver(new URL("http://usv-bmsapp-01.us.abc.edu:4444/wd/hub"), capabilities);**
**//remoteWD = new RemoteWebDriver(new URL("https://jenkins.us.abc.edu:4444/wd/hub"), capabilities);**
//remoteWD = new ChromeDriver();
System.out.println("I am after RMD");
remoteWD.get("http://www.google.com");
WebElement element = remoteWD.findElement(By.name("q"));
element.sendKeys("Selenium WebDriver");
element.submit();
Thread.sleep(10000);
System.out.println(remoteWD.getTitle());
remoteWD.quit();
}
Due to security reasons or whatever i am not able to connect "https://jenkins.us.abc.edu:4444/wd/hub", but when i give the server name like this "http://usv-bmsapp-01.us.abc.edu:4444/wd/hub" I am able to connect.
Following is the error message i am getting. Can someone help me where i am going wrong???
Running gridtest.GridTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#7dc5e7b4
I am before test
I am in test
I am after setting chromedriver path
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 95.6 sec <<< FAILURE!
GoogleTest(gridtest.GridTest) Time elapsed: 94.334 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to 10.190.33.90:17946 [/10.190.33.90] failed: Connection timed out
Command duration or timeout: 92.06 seconds
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.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at gridtest.GridTest.GoogleTest(GridTest.java:49)
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Connect to 10.190.33.90:17946 [/10.190.33.90] failed: Connection timed out
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'usv-bmsapp-01.us.umuc.edu', ip: '10.190.32.186', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-696.23.1.el6.x86_64', java.version: '1.8.0_77'
Driver info: driver.version: unknown
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:117)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:84)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:317)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:110)
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:128)
at org.seleniumhq.jetty9.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:745)
There seems to be a couple of issues which you ned to address as follows:
Selenium version
Logs in Node depicts:
Selenium version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
Logs in Console depicts:
Selenium version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
JDK version
Logs in Node depicts:
java.version '1.8.0_144'
Logs in Console depicts:
java.version '1.8.0_77'
Node startup command
The command which you have used to register the node looks error-pront as follows:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-rver-standalone-3.12.0.jar -role node -nodeConfig node.json
It should have been:
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-server-standalone-3.12.0.jar -role node -nodeConfig node.json
Solution
Upgrade JDK in Selenium Grid Hub and Selenium Grid Node to recent levels JDK 8u171.
Upgrade Selenium Client in Selenium Grid Hub and _Selenium Grid Node_to current levels Version 3.12.0.
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
nodeConfig
To start simple you can reduce the nodeConfig i.e. node.json as follows:
{
"capabilities": [
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5566,
"host": ip,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": jenkins.us.abc.edu,
"timeout":120,
"browserTimeout":60
}

Unable to use Firefox v52.0 with Protractor

I am currently having an issue trying to run Protractor tests on my Angular2 site when using GeckoDriver.
I am using Selenium Standalone Server to run my tests and they work in Chrome and IE11 but when I try to run with Firefox I get the following error:
Failed: Error while running testForAngular: Error: Permission denied to access property "invoke"
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'MyPC', ip: '128.87.191.161', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\Me\AppData\Local\Temp\rust_mozprofile.UbDrIDtk4eEX, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0, platformVersion=6.1, moz:processID=12820, browserName=firefox, platformName=windows_nt}]
Session ID: 6ddf7356-5306-4db6-b6c2-2898406c3193
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'MyPC', ip: '128.87.191.161', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\Me\AppData\Local\Temp\rust_mozprofile.UbDrIDtk4eEX, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0, platformVersion=6.1, moz:processID=12820, browserName=firefox, platformName=windows_nt}]
Session ID: 6ddf7356-5306-4db6-b6c2-2898406c3193
at AbstractExtendedWebDriver.get.timeout.driver.controlFlow.execute.then.then.then.then.then.then.executeAsyncScript_.then (c:\Projects\Project\ProtractorTests\node_modules\protractor\lib\browser.ts:944:27)
at ManagedPromise.invokeCallback_ (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\promise.js:1366:14)
at TaskQueue.execute_ (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\promise.js:2970:14)
at TaskQueue.executeNext_ (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\promise.js:2953:27)
at events.EventEmitter.events.EventEmitter.events.EventEmitter.scheduleCallbacks.asyncRun (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\promise.js:2813:27)
at c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Run beforeEach in control flow
From asynchronous test:
Error
at Suite.<anonymous> (C:\Projects\Project\ProtractorTests\specs\login-spec.ts:10:5)
at Object.<anonymous> (C:\Projects\Project\ProtractorTests\specs\login-spec.ts:8:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Array.forEach (native)
If I try to run the Firefox tests using directConnet I get another error:
[09:37:35] E/launcher - Unable to parse new session response: {"value": {"sessionId":"b00ee8b7-434e-48e6-83a6-3bca08caba31","value":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"52.0","moz:accessibilityChecks":false,"moz:processID":15632,"moz:profile":"C:\\Users\\Me\\AppData\\Local\\Temp\\rust_mozprofile.XS9ezQUYQ7um","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"6.1","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"page load":300000,"script":30000}}}}
[09:37:35] E/launcher - WebDriverError: Unable to parse new session response: {"value": {"sessionId":"b00ee8b7-434e-48e6-83a6-3bca08caba31","value":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"52.0","moz:accessibilityChecks":false,"moz:processID":15632,"moz:profile":"C:\\Users\\Me\\AppData\\Local\\Temp\\rust_mozprofile.XS9ezQUYQ7um","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"6.1","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"page load":300000,"script":30000}}}}
at __dirname.execute.request.then.doSend.then.response (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\http.js:445:19)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
at Function.createSession (c:\Projects\Project\ProtractorTests\node_modules\selenium-webdriver\firefox\index.js:640:55)
at Direct.getNewDriver (c:\Projects\Project\ProtractorTests\node_modules\protractor\built\driverProviders\direct.js:95:33)
at Runner.createBrowser (c:\Projects\Project\ProtractorTests\node_modules\protractor\built\runner.js:194:43)
at events_1.EventEmitter.run.q.then.then (c:\Projects\Project\ProtractorTests\node_modules\protractor\built\runner.js:338:29)
at _fulfilled (c:\Projects\Project\ProtractorTests\node_modules\q\q.js:834:54)
at Promise.then.Q.nextTick.self.promiseDispatch.done (c:\Projects\Project\ProtractorTests\node_modules\q\q.js:863:30)
at Promise.__dirname.Promise.promise.promiseDispatch (c:\Projects\Project\ProtractorTests\node_modules\q\q.js:796:13)
at c:\Projects\Project\ProtractorTests\node_modules\q\q.js:556:49
at runSingle (c:\Projects\Project\ProtractorTests\node_modules\q\q.js:137:13)
[09:37:35] E/launcher - Process exited with error code 199
Not sure where to go from here!
Versions
Angular: 2.4.6
Protractor: 5.1.1
Selenium Standalone Server: 3.3.1
GeckoDriver: 0.15.0
Firefox Browser: 52.0
The Permission denied to access property "invoke" is a known issue in Zone.js, specific to Zone.js and Firefox running with WebDriver. It was fixed in the 0.8.7 release. The issue involves how Zone.js patches the browser, and the only fix is to upgrade.
The Unable to parse new session response is also a known issue with Firefox 52 and directConnect: true. Unfortunately, the only solution is to use Selenium Standalone.