Skip to content

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

问题

web自动化测试脚本,编写了 setup 和 teardown,在运行case时,报 AttributeError XXX obiect has no attribute driver 185fa4bc-f59a-4bbe-9bd5-fe22afffcd0f|800x453

问题原因

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

解决办法

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

原文链接:https://ceshiren.com/t/topic/31842