Python+Selenium,tearDown方法使用cls.driver时,提示该类没有driver这个变量

Python+Selenium,tearDown方法使用cls.driver时,提示该类没有driver这个变量_第1张图片
由于driver这个变量是在类的方法setUp里定义的,另一个方法tearDown在调用类变量driver时,pyCharm就报错,提示没有这个类变量。这个我发现,可以不用管这个告警,只管使用这个变量,可以正常运行的。当然,前提是这个类继承的是unittest.TestCase这个类。

你可能感兴趣的:(笔记,python,selenium)