测试人社区

企业微信实战报 TypeError: argument of type 'bool' is not iterable,请帮忙看一下

企业微信实战,在获取成员时报TypeError: argument of type ‘bool’ is not iterable,信息如下:
--------------调用接口的代码-----------------
def test_addmember_fail(self):
username = ‘aaaabd’
acctidnum = ‘aaaabbb2p’
phonenum = ‘13402324367’
addmember = self.mian.goto_contact().goto_addmember()
addmember.add_member_fail(username, acctidnum, phonenum)
time.sleep(5)
assert username in addmember.get_member(username)
----------------获取成员的接口------------
def get_member(self, value):
total_list =
while True:
member_list = self.finds(By.CSS_SELECTOR, ‘.member_colRight_memberTable_td:nth-child(2)’)
# 列表推导式
title_list = [element.get_attribute(‘title’) for element in member_list]
if value in title_list:
return True
total_list = total_list + title_list
result: str = self.find(By.CSS_SELECTOR, ‘.ww_pageNav_info_text’).text
num, total = result.split(’/’, 1)
if int(num) == int(total):
return False
else:
self.find(By.CSS_SELECTOR, ‘.js_next_page’).click()
# 循环获取属性
# for element in memberlist:
# titlelist.append(element.get_attribute(‘title’))

    return total_list

-------------------报错----------------
test_addmember.py::TestWX::test_addmember_fail FAILED [100%]
test_addmember.py:20 (TestWX.test_addmember_fail)
self = <podemo_wx.testcase.test_addmember.TestWX object at 0x00000183E0CD3B38>

@allure.story('主页->通讯录->点击添加成员->添加联系人')
def test_addmember_fail(self):
    username = 'aaaabd'
    acctidnum = 'aaaabbb2p'
    phonenum = '13402324367'
    addmember = self.mian.goto_contact().goto_addmember()
    addmember.add_member_fail(username, acctidnum, phonenum)
    time.sleep(5)
  assert username in addmember.get_member(username)

E TypeError: argument of type ‘bool’ is not iterable

test_addmember.py:29: TypeError

打个断点,检查下member_list ,title_list数据内容对不对;看报错是你去遍历了一个布尔型的数据