robotframework-appiumflutterlibrary
robotframework-appiumflutterlibrary copied to clipboard
[Help Request] How can we user Appium switch context function
Hi all, I need to use switch flutter driver to UiAutomator2, Is it possible with this library ? It would be very helpfull for hybrid applications and using ui automator 2 functions . Also we can support our tests with Ocr library with uiautomator2.
Well, We are looking for the implementation of a switch context keyword. Even if we can't we will add and execute script keyword to handle scripts from other drivers
I add some code in appiumflutter library
_applicationmanagement.py
def switch_to_context(self, context_name):
"""Switch to a new context"""
self._current_application().switch_to.context(context_name)
_element.py
from appium.webdriver.common.appiumby import AppiumBy
def click_element_by_xpath(self, locator):
self._current_application().find_element(AppiumBy.XPATH, locator).click()
def click_element_by_Id(self, locator):
self._current_application().find_element(AppiumBy.ID, locator).click()
def input_text_by_xpath(self, locator, text):
self._current_application().find_element(AppiumBy.XPATH, locator).send_keys(text)
then on your robot file
Switch To Context NATIVE_APP
Click Element By ID com.google.android.documentsui:id/thumbnail
Click Element By Xpath //android.widget.LinearLayout[@index="1"]/android.widget.RelativeLayout/android.widget.FrameLayout[@resource-id="com.google.android.documentsui:id/thumbnail"]
Switch To Context FLUTTER