Prototype of https://github.com/appium/java-client/issues/52 solution