Skip to content

运行web自动化,报AttributeErrorXXX obiect has no attribute driver

问题

web 自动化测试脚本,编写了 setup 和 teardown,在运行 case 时,报 AttributeError XXX obiect has no attribute driver

问题原因

pytest 版本太高,未兼容 使用的 pytest 版本为 8.x.x 版本

解决办法

  1. 将 setup 和 teardown 换成 setup_class teardown_class,可以运行
  2. 将 pytest 版本降成 7.x.x 版本,setup 和 teardown 可运行

原文链接