Search code examples
pythonappiumwait

Wait Until Partial Text is present in Appium (Python)


Is there any way to wait for partial text "Score: 100%" to be present at least on the screen or appeared in the specified element id? The whole element text looks like: "Answered: x/y, Score: N%" and it changes with a delay. I need to execute the next command only after the Score gets 100%.


Solution

  • You can use text_to_be_present_in_element from ExpectedConditions to accomplish this.

    WebDriverWait(driver, 10).until(
            EC.text_to_be_present_in_element((By.ID, "myElementId"), "Score: 100%"))