Home  >  Article  >  WeChat Applet  >  Solution to error reported after upgrading selenium 3.3.0

Solution to error reported after upgrading selenium 3.3.0

PHPz
PHPzOriginal
2017-03-18 17:47:401908browse

Solution to the error after upgrading selenium 3.3.0

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

The error when executing the test is as follows:

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

The reason is: 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'...

Refer to the official website description:

Solution to error reported after upgrading selenium 3.3.0


The above is the detailed content of Solution to error reported after upgrading selenium 3.3.0. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn