for li in lis:
title = li.find_element(By.XPATH,'.job-area').text
print(title)
—
File "D:\dev\pycharm_sapce\demo\demo01\boos.py", line 10, in
for li in lis:
TypeError: 'WebElement' object is not iterable
应该使用find_elements_by_xpath而不是find_element_by_xpath
for li in lis其中lis是 webelement对象,不是可迭代对象,无法遍历,你将lis转换成list对象后再去遍历,或者不遍历直接用lis.find_element()。