升級selenium3.3.0后執(zhí)行測試時報錯怎么辦

這篇文章主要介紹升級selenium 3.3.0后執(zhí)行測試時報錯怎么辦,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

專注于為中小企業(yè)提供網站建設、網站制作服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)云龍免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯網行業(yè)人才,有力地推動了超過千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現規(guī)模擴充和轉變。

升級 selenium 3.3.0 后報錯解決辦法

sudo pip install --upgrade selenium
In [4]: import selenium
In [5]: selenium.version
Out[5]: '3.3.0'

執(zhí)行測試時報錯如下:

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后執(zhí)行測試時報錯怎么辦

以上是“升級selenium 3.3.0后執(zhí)行測試時報錯怎么辦”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯行業(yè)資訊頻道!

文章標題:升級selenium3.3.0后執(zhí)行測試時報錯怎么辦
文章分享:http://bm7419.com/article12/pcdedc.html

成都網站建設公司_創(chuàng)新互聯,為您提供品牌網站建設、手機網站建設、關鍵詞優(yōu)化網站收錄、網站導航、微信小程序

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

h5響應式網站建設