With the popularity of Python3, Selenium3 caught up. The biggest change in Selenium3 is that Selenium RC is removed, and Webdriver is removed from the respective browsers and must be downloaded separately.

1. Multiple Python versions coexist on Windows (Python 2.7.8 already installed)

You can download Python and PIP through Python and PIP

Natively installed versions of Python 2.7.8 and Python 3.5

Download Python and install it, adding the environment variable path

D:\Python\Python35-32\Scripts\; D:\Python\Python35-32\; D:\Python27\; D:\Python27\Scripts\;

Go to D:\Python27 and change python.exe to python2.exe

Go to D:\Python\ python35-32 and change python.exe to python3.exe

Unzip the downloaded PIP and run python2 setup.py install/python3 setup.py install

Run the PIP list command to check whether the PIP is installed successfully.





python3-pip list

Install Selenium in Python3

Go to D: Python\ python35-32 \Scripts\ and run PIP. Exe install Selenium





successfully install selenium

3. Install the Selenium server

Download selenium-server-standalone at the Selenium download address. X.X.X. jar

Install the Selenium server by executing the Java-jar selenium-server-standalone-3.3.1.jar

4. Install Firefox GeckoDriver

Install the latest version of Firefox and add the Firefox executable to the system environment variables. Remember to turn off automatic updates in Firefox

Install geckodriver

Place the downloaded geckodriver.exe in the path D:\Python\ python35-32 \

5. Simple examples

An example of python_org_search.py from the official website.

from selenium import webdriver

from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()

driver.get(“http://www.python.org”)

assert “Python” in driver.title

elem = driver.find_element_by_name(“q”)

elem.clear()

elem.send_keys(“pycon”)

elem.send_keys(Keys.RETURN)

assert “No results found.” not in driver.page_source

driver.close()

Run pythON3 python_org_search.py

Implement interface





firefox

Step on the pit

1. Install geckoDriver





error 1

2. Upgrade Firefox





error 2

3. If Firefox is not installed in the default directory, the webdriver.py and firefox_binary.py configurations need to be changed





error

4. Don’t understand the version matching between plug-ins. Fortunately, I can run ~~~