org.openqa.selenium.UnsupportedCommandException: getSession

Hi, i’m facing an issue about HttpCommandExecutor

I’m actually behind a proxy that’s why i try to implement a proxy in my code to communicate with my appium server (browserStack).

For this, i use the following solution : https://stackoverflow.com/questions/34846014/using-selenium-remotewebdriver-behind-corporate-proxy/34908953#34908953,

This one works with selenium but not with appium because this error is thrown : org.openqa.selenium.UnsupportedCommandException: getSession

the bug is very similar to this one : https://github.com/appium/java-client/issues/821. It seems that HttpCommandExecutor are not working correctly with appium !

I tried to set up a proxy with System.setProperty(“http.proxyHost”, “myHost”) and same for port but it’s not working

Do you have any suggestions, or a workaround to use appium behind a proxy ?

Many thanks in advance

If you are Overriding Execute method of HttpCommandExecutor, then use the below line in that method, which will define commands for appium in the remotewebdriver.

getAdditionalCommands().forEach(this::defineCommand);