初次写python 代码,采用百度demo,遇到问题:
AttributeError: ‘xxxxx’ object has no attribute ‘driver’
AttributeError: ‘xxxxx‘ object has no attribute ‘driver‘
AttributeError: ‘xxxxx‘ object has no attribute ‘driver‘

根据建议, 解决布置如下:

  1. 规范代码,完善缩进
  2. 检查chromedriver (正确)
  3. 再次检查代码,发现 setup里面的小写u应该改成大写U, 应该改成setUp (问题所在)
  4. 重新运行,成功

关于setUp()和tearDown()函数: https://www.cnblogs.com/insane-Mr-Li/p/9085062.html

AttributeError: ‘xxxxx‘ object has no attribute ‘driver‘
AttributeError: ‘xxxxx‘ object has no attribute ‘driver‘

相关文章: