Hello,
Can I wait for an element I don’t know its accessibility id yet?
Is it possible to use a starts-with expression on a wait?
After performing a search, the AUT will present a XCUIElementTypeStaticText, which’s name is: Result (x), x being the number of results returned.
I need to retrieve this element to proceed with the test.
I’ve managed to work around it by using a sleep, but I would like to have a more elegant solution, using an explicit wait.
This will find my element, but will fail if it hasn’t been loaded (thus, the sleep):
element = self.driver.find_element_by_ios_predicate(“type==‘XCUIElementTypeStaticText’ AND name BEGINSWITH[c] ‘Result’”)
I’ve tried these two options, none of them working:
self.wait.until(expected_conditions.presence_of_element_located((self.driver.find_element_by_ios_predicate(“type ==‘XCUIElementTypeStaticText’ AND name BEGINSWITH[c] ‘Result’”))))
self.wait.until(expected_conditions.presence_of_element_located((By.XPATH,"//input[@class=‘XCUIElementTypeStaticText’ and starts-with(@id, ‘Result’)]")))
Thanks,
Elias