这篇文章主要介绍升级selenium 3.3.0后执行测试时报错怎么办,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创新互联建站拥有10多年成都网站建设工作经验,为各大企业提供成都做网站、成都网站建设服务,对于网页设计、PC网站建设(电脑版网站建设)、成都APP应用开发、wap网站建设(手机版网站建设)、程序开发、网站优化(SEO优化)、微网站、主机域名等,凭借多年来在互联网的打拼,我们在互联网网站建设行业积累了很多网站制作、网站设计、网络营销经验,集策划、开发、设计、营销、管理等网站化运作于一体,具备承接各种规模类型的网站建设项目的能力。升级 selenium 3.3.0 后报错解决办法
sudo pip install --upgrade selenium In [4]: import selenium In [5]: selenium.version Out[5]: '3.3.0'
执行测试时报错如下:
swot@pp:~/pp/superlists$ python manage.py test functional_tests.tests.NewVisitorTest.test_layout_and_styling Creating test database for alias 'default'... E ====================================================================== ERROR: test_layout_and_styling (functional_tests.tests.NewVisitorTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/swot/pp/superlists/functional_tests/tests.py", line 123, in test_layout_and_styling inputbox.location.get('x') + inputbox.size['width']/2, File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 403, in location new_loc = {"x": round(old_loc['x']), TypeError: 'NoneType' object has no attribute 'getitem' ---------------------------------------------------------------------- Ran 1 test in 4.378s FAILED (errors=1) Destroying test database for alias 'default'...
原因是:Selenium 3.3.0 requires geckodriver 0.15 due to changes in command response values
wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz tar xzvf geckodriver-v0.14.0-linux64.tar.gz sudo cp geckodriver /usr/local/bin python manage.py test functional_tests.tests.NewVisitorTest.test_layout_and_styling Creating test database for alias 'default'... . ---------------------------------------------------------------------- Ran 1 test in 5.307s OK Destroying test database for alias 'default'...
参考官网说明:
以上是“升级selenium 3.3.0后执行测试时报错怎么办”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!