Not able to launch new session on saucelabs for my selenium automation mobile script












0














Running selenium automation script on saucelabs, but getting below error. Could not find the failure reason.:-
Note:- Also referred similar questions asked previously on stackoverflow but didn't helped me.




FAILED CONFIGURATION: @BeforeClass setup
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.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
at com.automation.mobile.Tests.TestBase.setup(TestBase.java:43)
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.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:84)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 35 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
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:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)




Below is my selenium script:-



import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;


public class TestBase {
AppiumDriver<MobileElement> driver;
public static final String USERNAME = "xxx";
public static final String ACCESS_KEY = "yyy";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub";

@BeforeClass
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("name", "Calculator_test");
capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("fullReset", "false");
capabilities.setCapability("browserName", "");
capabilities.setCapability("appiumVersion", "1.5.3");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.calculator2");
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");

driver=new AndroidDriver<MobileElement>(new URL(URL),capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

}

@Test
public void run() {
driver.findElementById("com.android.calculator2:id/digit_7").click();
driver.findElementByAccessibilityId("plus").click();
driver.findElementByXPath("//*[@text='2']").click();
driver.findElementByAccessibilityId("equals").click();
String result=driver.findElementById("com.android.calculator2:id/result").getText();
if(result.equals("9"))
Assert.assertTrue(true);
else
Assert.assertTrue(false);
}

@AfterClass
public void tearDown(ITestResult result) {
((JavascriptExecutor) driver).executeScript("sauce:job-result=" + (result.isSuccess() ? "passed" : "failed"));
driver.quit();
}
}









share|improve this question
























  • You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    – Krishnan Mahadevan
    Nov 14 at 2:57
















0














Running selenium automation script on saucelabs, but getting below error. Could not find the failure reason.:-
Note:- Also referred similar questions asked previously on stackoverflow but didn't helped me.




FAILED CONFIGURATION: @BeforeClass setup
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.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
at com.automation.mobile.Tests.TestBase.setup(TestBase.java:43)
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.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:84)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 35 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
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:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)




Below is my selenium script:-



import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;


public class TestBase {
AppiumDriver<MobileElement> driver;
public static final String USERNAME = "xxx";
public static final String ACCESS_KEY = "yyy";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub";

@BeforeClass
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("name", "Calculator_test");
capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("fullReset", "false");
capabilities.setCapability("browserName", "");
capabilities.setCapability("appiumVersion", "1.5.3");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.calculator2");
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");

driver=new AndroidDriver<MobileElement>(new URL(URL),capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

}

@Test
public void run() {
driver.findElementById("com.android.calculator2:id/digit_7").click();
driver.findElementByAccessibilityId("plus").click();
driver.findElementByXPath("//*[@text='2']").click();
driver.findElementByAccessibilityId("equals").click();
String result=driver.findElementById("com.android.calculator2:id/result").getText();
if(result.equals("9"))
Assert.assertTrue(true);
else
Assert.assertTrue(false);
}

@AfterClass
public void tearDown(ITestResult result) {
((JavascriptExecutor) driver).executeScript("sauce:job-result=" + (result.isSuccess() ? "passed" : "failed"));
driver.quit();
}
}









share|improve this question
























  • You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    – Krishnan Mahadevan
    Nov 14 at 2:57














0












0








0







Running selenium automation script on saucelabs, but getting below error. Could not find the failure reason.:-
Note:- Also referred similar questions asked previously on stackoverflow but didn't helped me.




FAILED CONFIGURATION: @BeforeClass setup
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.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
at com.automation.mobile.Tests.TestBase.setup(TestBase.java:43)
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.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:84)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 35 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
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:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)




Below is my selenium script:-



import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;


public class TestBase {
AppiumDriver<MobileElement> driver;
public static final String USERNAME = "xxx";
public static final String ACCESS_KEY = "yyy";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub";

@BeforeClass
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("name", "Calculator_test");
capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("fullReset", "false");
capabilities.setCapability("browserName", "");
capabilities.setCapability("appiumVersion", "1.5.3");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.calculator2");
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");

driver=new AndroidDriver<MobileElement>(new URL(URL),capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

}

@Test
public void run() {
driver.findElementById("com.android.calculator2:id/digit_7").click();
driver.findElementByAccessibilityId("plus").click();
driver.findElementByXPath("//*[@text='2']").click();
driver.findElementByAccessibilityId("equals").click();
String result=driver.findElementById("com.android.calculator2:id/result").getText();
if(result.equals("9"))
Assert.assertTrue(true);
else
Assert.assertTrue(false);
}

@AfterClass
public void tearDown(ITestResult result) {
((JavascriptExecutor) driver).executeScript("sauce:job-result=" + (result.isSuccess() ? "passed" : "failed"));
driver.quit();
}
}









share|improve this question















Running selenium automation script on saucelabs, but getting below error. Could not find the failure reason.:-
Note:- Also referred similar questions asked previously on stackoverflow but didn't helped me.




FAILED CONFIGURATION: @BeforeClass setup
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.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
at com.automation.mobile.Tests.TestBase.setup(TestBase.java:43)
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.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ULTP_444', ip: '172.24.7.181', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_181'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:84)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 35 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
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:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)




Below is my selenium script:-



import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;


public class TestBase {
AppiumDriver<MobileElement> driver;
public static final String USERNAME = "xxx";
public static final String ACCESS_KEY = "yyy";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub";

@BeforeClass
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("name", "Calculator_test");
capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("fullReset", "false");
capabilities.setCapability("browserName", "");
capabilities.setCapability("appiumVersion", "1.5.3");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.calculator2");
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");

driver=new AndroidDriver<MobileElement>(new URL(URL),capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

}

@Test
public void run() {
driver.findElementById("com.android.calculator2:id/digit_7").click();
driver.findElementByAccessibilityId("plus").click();
driver.findElementByXPath("//*[@text='2']").click();
driver.findElementByAccessibilityId("equals").click();
String result=driver.findElementById("com.android.calculator2:id/result").getText();
if(result.equals("9"))
Assert.assertTrue(true);
else
Assert.assertTrue(false);
}

@AfterClass
public void tearDown(ITestResult result) {
((JavascriptExecutor) driver).executeScript("sauce:job-result=" + (result.isSuccess() ? "passed" : "failed"));
driver.quit();
}
}






java android selenium-webdriver saucelabs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 at 2:55









Krishnan Mahadevan

8,17531541




8,17531541










asked Nov 12 at 6:38









Vishal Jagtap

662713




662713












  • You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    – Krishnan Mahadevan
    Nov 14 at 2:57


















  • You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    – Krishnan Mahadevan
    Nov 14 at 2:57
















You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
– Krishnan Mahadevan
Nov 14 at 2:57




You seem to be using a very old version of selenium Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'ULTP_444', ip: '172.24.7.181',. Can you please try using the latest version of TestNG 3.141.0. I say this because you seem to be having an SSL error org.openqa.selenium.WebDriverException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
– Krishnan Mahadevan
Nov 14 at 2:57

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53257018%2fnot-able-to-launch-new-session-on-saucelabs-for-my-selenium-automation-mobile-sc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53257018%2fnot-able-to-launch-new-session-on-saucelabs-for-my-selenium-automation-mobile-sc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values