溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

升級(jí)selenium 3.3.0后執(zhí)行測(cè)試時(shí)報(bào)錯(cuò)怎么辦

發(fā)布時(shí)間:2021-01-18 14:13:48 來(lái)源:億速云 閱讀:239 作者:小新 欄目:移動(dòng)開(kāi)發(fā)

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

升級(jí) selenium 3.3.0 后報(bào)錯(cuò)解決辦法

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

執(zhí)行測(cè)試時(shí)報(bào)錯(cuò)如下:

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'...

參考官網(wǎng)說(shuō)明:

升級(jí)selenium 3.3.0后執(zhí)行測(cè)試時(shí)報(bào)錯(cuò)怎么辦

以上是“升級(jí)selenium 3.3.0后執(zhí)行測(cè)試時(shí)報(bào)錯(cuò)怎么辦”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI