I am building a Robot Framework library in Python that is meant to be used on tests that run on mobile devices.
After opening an app/browser on the device (when running the tests), I need to get the Appium Webdriver that is being used and send it as a parameter on an external tool method.
Everything works great when working with mobile apps, but when opening the browser (Chrome) on the mobile device, the behaviour is different. I send the driver as a parameter and an exception is thrown:
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: unknown error: Location must be set before it can be retrieved
(Session info: chrome=72.0.3626.96)
(Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 10.0.16299 x86_64)
Any idea why this might be happening, and how can I fix it?
What could be different about opening a session in a browser that makes this happen, since it all works alright when working with native apps?
This is the code I’m using to retrieve the driver:
libraryInstances = BuiltIn().get_library_instance('', True)
if 'AppiumLibrary' in libraryInstances:
appiumLibraryInstance = libraryInstances['AppiumLibrary']
appiumdriver = appiumLibraryInstance._current_application()
driver = appiumdriver