UnsupportedCommandException: getSession error occurs when setting timeout for appium android webdriver
See original GitHub issueDescription
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)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:14 (3 by maintainers)
Top GitHub Comments
I am facing a similar issue for AndroidDriver. No issues observed for iOS.
I get
UnsupportedCommandExecution
when I callnew AppiumFieldDecorator(driver)
inside a PageObject constructor. When I debugged in, I see that AppiumFieldDecorator tries to invokeHasSessionDetails.getSession("platformName")
which in turn tries to execute aGET /session
and fails.This is screenshot of debugging code where I see the response after executing
GET /session
isSessionID: null, Status: 9, Value: null
Also when I debugged actual response from ApacheHttpClient for GET http://127.0.0.1:4723/wd/hub/session/<sessionId>, it is 404 Not Found.
Environment
OS: macOS High Sierra Appium Server: 1.7.2 appium-java-client: 6.0.0-BETA4 Selenium version: 3.9.0 Others: IntelliJ, Java 1.8.0_161
This issue has completely blocked me from executing tests for Android. Can someone please take a look??
@ryltar , @thaitrongnghi , @cdj0924 has anything worked for you?
@SrinivasanTarget , @saikrishna321 Could you please help take a look?
@thaitrongnghi @SrinivasanTarget @saikrishna321 @ryltar To resolve issue additional Appium commands should be supplied. This commands are available in
io.appium.java_client.MobileCommand.commandRepository
repository.So executor should be constructed something like this