I have the following in Python 3.6:
name = ‘Jae Garik’
And when I try to pass in the variable like this:
self.driver.find_element_by_android_uiautomator(‘new UiSelector().text(f"{name}")’).click()
I get error:
selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
This didn’t work either:
self.driver.find_element_by_android_uiautomator(‘new UiSelector().text("\""+name+"\"")’).click()
It gave me the same error as above.
But if I do it with the literal string:
self.driver.find_element_by_android_uiautomator(‘new UiSelector().text(“Jae Garik”)’).click()
It works perfectly. Can anybody help with this issue? It feels like I’m missing something very small but I can’t figure it out.