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.
thanks for responding. I think you may have misunderstood the problem I am experiencing. In the example that you gave, it would be as if your first two lines were:
username = ‘venkatesh’
el = self.driver.find_element_by_id(username)
In these screenshots, I’m trying to find the name Nat Gray and clicking on it. I’m attempting to accomplish that by passing the string as a variable into the locator.
If I pass in the literal string “Nat Gray” to the locator, it works fine.
But if I assign a variable like this:
name_to_pass = “Nat Gray”
And pass in the variable name_to_pass to the locator, it doesn’t work.