def ckid(self, x):
try:
self.driver.find_element_by_id(x)
except:
# saveScreen.saveScreen(self.driver, x)
print
u'未发现' + x
return False
return True
def judgeid(self, x):
if not (self.ckid(x)):
try:
assert self.ckid(x) == True
except:
saveScreen.saveScreen(self.driver, x)
print x + u'没找到'
finally:
self.driver.quit()
else:
None
执行 case 的过程中如果没有找到某个元素,会执行 finally 里的 quit(),但是还有 teardown 里的 quit(),这样会报错,应该怎么改?