Hello All~ I just have a question about using different keyword in different system.
For example, I need to use AppiumLibrary to create the test case for Android and iOS. All test cases are done for Android and I would like to reuse the test case for iOS.
In Android, it is fine to use the keyword - “[Wait Until Element Is Visible]” . But in iOS, i can only use “[Wait Until Page Contains Element]”.
Since all test cases are written, and I dont want to have two set of test cases, would like to ask ,
- is there a way to overwrite a keyword action to another keyword
or
- how to edit the function or overwrite the function from the Library. (I tried to use below monkey patching , but seems it is not useful. It still use the original code.)
edit_function.py:
from AppiumLibrary.keywords._waiting import _WaitingKeywords
def newFunction(self, locator, timeout=None, error=None):
print(“Hello”)
def Replaceios():
_WaitingKeywords.wait_until_element_is_visible = newFunction
testcase.robot
*** Settings ***
Library AppiumLibrary
Library edit_function.py
*** Test Cases ***
This is Test Case
Replaceios
Open Application ${remoteUrl}…
Wait Until Element Is Visible id=elementId