'Explicit wait utility

I am using one generic explicit wait utility which can be used in different places in my test case. Following is the code I have written for the same under Base Test. Here I am looking for a text to present in the screen.For that I have given the parameter "text" in the function VerifyTextPresence.

But after running the script, I am having the below error. How to make it generic so that for any text, I can use this utility. For example, here I am checking for the text "Get" to be present in the screen

Utility Code:

def VerifyTextPresence(self,text):
    wait = WebDriverWait(self.driver, 15)
    element = wait.until(EC.presence_of_element_located((AppiumBy.ANDROID_UIAUTOMATOR, 'new UiSelector().text(text)'))).text

Test Script:

def test_testcasename(self):
        self.VerifyTextPresence("Get")

Error:

io.appium.uiautomator2.common.exceptions.UiSelectorSyntaxException: Could not parse expression `new UiSelector().textGet`: No opening parenthesis after method name at position


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source