老师为什么我不用unittest没有报错,但使用了unittest而不行了呢
来源:1-1 课程介绍

weixin_慕运维6585699
2021-11-02
FAILED [100%]
Test_zjw_shaixuan.py:60 (Test_RegisterFunction.test_jz_gongye_duanyan)
self = <Test_zjw_shaixuan.Test_RegisterFunction object at 0x000002C0080983C8>
def test_jz_gongye_duanyan(self):
jz_gy_lingyue = self_driver.get_user_element('jz_lingyudy')
self_driver.get_user_element('jz_lingyudy')
jz_gy_hs_shuzu = ['水电站']
# print(hb_shuzu)
# self.assertTrue(jz_gy_hs_shuzu)
for index in range(len(jz_gy_hs_shuzu)):
# print('进入了第一个循环语句')
# print('huanbao的内容'+huanbao.text)
if jz_gy_hs_shuzu[index] in jz_gy_lingyue.text:
E AttributeError: ‘NoneType’ object has no attribute ‘text’
Test_zjw_shaixuan.py:71: AttributeError
写回答
1回答
-
Mushishi
2021-11-03
E AttributeError: ‘NoneType’ object has no attribute ‘text’ 你这里huanbao时一个none。 肯定不可能说unittest 之后不行,你debug一下。
00
相似问题