变量扩展不会发生在多个引号内。这是代码
products = ['One','Two','Three']
for i in range(0,len(products)):
el = self.driver.find_element_by_android_uiautomator('new UiSelector().text("{}")').format(products[i])
print (el)
预期结果应该是:
el = self.driver.find_element_by_android_uiautomator('new UiSelector().text("One")')
错误信息:
File "temp_test.py", line 84, in test_product
el = self.driver.find_element_by_android_uiautomator('new UiSelector().text("{}")').format(products[i])
NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
请帮我解决这个问题!!!