Python python binding Selenium WebDriver

I cannot make python bindings for webdriver workable. The following is for installation.

easy_install webdriver

The webdriver package will not find, so I have to install it manually from sources. I loaded the source from the trunk, set the WEBDRIVER and PYTHONPATH variables, and set the webdriver:

   ~$ cd ~
   ~$ svn checkout http://selenium.googlecode.com/svn/trunk/ selenium-read-only
   ~$ cd selenium-read-only
   ~# python setup.py install
   ~$ env |grep PYT
   ~$> PYTHONPATH=:/home/ockonal/selenium-read-only/../../../firefox/lib-src:/home/ockonal/selenium-read-only/..
   ~$ env |grep WEB
   ~$> WEBDRIVER=/home/ockonal/selenium-read-only

Here is the output of setup.py script output.

Then I downloaded RemoteDriverServer.jar and ran it:

java -jar RemoteDriverServer.jar 8888

Now I want to enable the webdriver module in a python script:

from selenium.firefox.webdriver import WebDriver

ImportError: no module named firefox.webdriver

+3
source share
5 answers

.

, :

/usr/local/lib/python2.6/

site-packages dist-packages.

setup.py , , "" setup.py

:

/usr/local/lib/python2.6/dist-packages/selenium/firefox/

/usr/local/lib/python2.6/site-packages/selenium/firefox/

, python setup.py, setup.py.

, , .

./firefox/source/py/

, .

/usr/local/lib/python2.6/dist-packages/selenium/firefox/

/usr/local/lib/python2.6/site-packages/selenium/firefox/

" ". , , firefox setup.py.

...

'selenium.firefox': 'firefox/src/py',
...

dist-, "setup.py install" ​​, .

"setup.py install" sudo, . , root- / - '/usr'.

+6

selenium ( webdriver) pip :

pip install selenium
+7

build/webdriver-extension.zip python. build/webdriver-extension.zip /usr/lib/pythonX.X/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox. , .

+2
sudo pip install selenium 

Ubuntu 10.04

sudo pip install -U selenium

+1

, . Python 3, homebrew selenium, pip3. "ImportError: " ". , :

import sys
print(sys.path) 

, , , (/usr/local/lib/Python3.4/site-packages).

, selenium - selenium-2.45. , , , , selenium , selenium-2.45.

I don’t think this is the final solution, as it goes to configure the script, but at the moment it works very well, and I can use the selenium module and its contents (so far).

0
source

Source: https://habr.com/ru/post/1746683/


All Articles