【发布时间】:2021-09-13 16:09:39
【问题描述】:
得到: AttributeError: 'str' object has no attribute 'text' 错误如下:
`version = driver.find_element_by_id('com.project.PROJECT:id/version').text
print(version)
for i in version:
if 'Version : 1.2.0.133' == str(i):
print('Step 46. NAS version is displayed correctly - PASS')
else:
print('Step 46. NAS version is incorrect - Fail')
time.sleep(2)
pass`
也试过了:if 'Version : 1.2.0.133' == i.text
还是不行。
print(version) 正在返回正确的值:版本:1.2.0.133
但我无法打印if value is true: print('Step 46. NAS version is displayed correctly - PASS')
用else print FAIL value向我发送垃圾邮件
另外,如果我使用.text 进行 EC 等待也会返回错误。
谢谢
【问题讨论】:
标签: python android selenium attributes webdriver