1. Downloading and Setting up Pip and Python
Click here to download python
Click to open the installer and choose Custom Installation.
Leave the boxes checked in the "Optional Features" section and click Next.
In the "Advanced Options" section, check Add Python to environment variables. Also, click Browse and choose a suitable location for your python files to be installed into. Once, finished click Install.
Note: It is recommended to create the containing folder in this location as each of the installed files and folders will be unpacked here.
Close the window once the installation is complete
2. Installing Eclipse IDE
Click here to download the latest installer for Eclipse IDE.
Open the file you just downloaded and when it asks for what type of Eclipse installation you want, select Eclipse IDE for Java Developers.
Afterwards, you will be asked where you want eclipse installed, you can leave this as its default value unless you have somewhere specific you want it to be installed.
Next click launch and choose the workspace folder. This will be where your projects are stored.
Once the workspace folder has been chosen, click launch to open Eclipse.
3. Downloading Python Selenium Driver files
Open the cmd or powershell terminal and enter the following command:
pip install selenium
Click here to download the chromedriver that matches the version of chrome on your PC. To check the version of chrome you have installed, click the three small dots in the top-right of the Chrome window, then click Help > About Google Chrome.
Create a folder somewhere and store Chromedriver.exe there, note down the location for later.
4. Configuring Eclipse to use Selenium files
Launch Eclipse if it isn't already open, and choose your workspace file location.
Go to Help > Install New Software....
In the Work with: box type "http://pydev.org/updates" and press enter. In the results box, select each check box and press Next. Click Next in the following windows, accepting the license agreement when prompted.
When prompted with a security warning, select the "unsigned" checkbox and press Trust Selected.
Go to Window > Preferences
Navigate to PyDev > Interpreters > Python Interpreter.
Click New > Browse for python/pypy exe
In the following window, if a file explorer window is not automatically opened, click Browse. Next, search for and select the python.exe file.
If prompted press OK to adding folders to the SYSTEM pythonpath.
Click Apply and Close.
In the Package Explorer, click Create a project... and in the following window, click PyDev > PyDev Project.
Give the project a name and click Finish. Then check "Remember my decision" and click Open Perspective in the next window that pops up.
Right-click the project you created and click New > PyDev Package
Provide the package with a name and click Finish.
Right-click the package you just created and select New > PyDev Module.
Provide the module with a name and click Finish. Click OK in the next window to pop up.
5. Testing the Selenium Setup
In the module you created in Section 4, copy in the following code. Replace FILEPATH with the path to the chromedriver file.
from selenium import webdriver driver = webdriver.Chrome(executable_path="FILEPATH") driver.get("https://www.google.com") print(driver.title) driver.close()
Run the file as a Python unit-test. If the setup was successful, you should see a chrome window launch and briefly navigate to google before closing. You will also see the word "Google" appear in the console output.
Getting errors you can't seem to fix
If you received errors during this process and can't find an easy fix anywhere, you might be considering shortcuts to finish the process. If you just want to get to a point where you can start writing your own selenium code right away, use MaxTAF Cloud.
You won't receive any errors while setting up MaxTAF Cloud because it is all already set up for you. All you need is a valid email address, and you can start writing test cases for free. The only costs occur when you feel like you need advanced features, like running many tests in parallel, or an extended storage space for test reports and cases.