Skip to content

UnsupportedCommandException: getSession error occurs when setting timeout for appium android webdriver #821

@thaitrongnghi

Description

@thaitrongnghi

Description

I want to custom HTTP timeout when connecting to Appium server but it is always failed. Please see
script to reproduce in "My script" section. Appreciate any suggestions, thank you a lot!

Environment

OS: macOS Sierra
appium-java-client: 6.0.0-BETA2
Selenium version: 3.4.0
Others: IntelliJ, Java 1.8.0_121-b13

My script

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceOrientation", "portrait");
capabilities.setCapability("app", "/Users/local/Downloads/appTest.apk");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("deviceName", "HTC");

int con_timeout = 1200000;
int soc_timeout = 90000;
ApacheHttpClient.Factory clientFactory = new ApacheHttpClient.Factory(new
HttpClientFactory(con_timeout, soc_timeout));
AppiumCommandExecutor executor = new AppiumCommandExecutor(new HashMap<String,
AppiumCommandInfo>(), new URL("http://localhost:4723/wd/hub"), clientFactory);
driver = new AndroidDriver<>(executor, capabilities);
driver.launchApp();
sleep(200);

Error log from client side

It gives an error at step "driver = new AndroidDriver<>(executor, capabilities);" in my below script.
org.openqa.selenium.UnsupportedCommandException: getSession
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'localhost', ip: '*', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_121'
Driver info: driver.version: AndroidDriver

at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:220)
at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:118)
at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:130)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at io.appium.java_client.HasSessionDetails.getSessionDetails(HasSessionDetails.java:36)
at io.appium.java_client.HasSessionDetails.getSessionDetail(HasSessionDetails.java:42)
at io.appium.java_client.HasSessionDetails.getPlatformName(HasSessionDetails.java:46)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:100)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:63)
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:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.TestRunner.beforeRun(TestRunner.java:626)
at org.testng.TestRunner.run(TestRunner.java:594)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions