1. The source code for this project can be downloaded here.
2. A simple version of this tutorial, for Windows users only, can be found here.
What this tutorial will cover:
- Who is this tutorial for?
- Create Project
- Add packages to SDK
- Setting up ChromeDriver
- Setting up Source Code
- Running Project
- Additional Resources
 Who is this tutorial for?
This tutorial is for you only if:
- You have many DDG images you want to download in bulk, automatically.
- You are familiar with code, and preferably, wanted to learn to code regardless of DDG.
- You see yourself doing more development after this project is done.
 Intellij Installation
I recommend the Intellij CE + Python Plugin, since Intellij CE is free and supports multiple languages, and the other alternative, installing PyCharm, provides no additional functionality. So basically you get multi-language for free by choosing Intellij CE + the Python Plugin.
Intellij CE installation (for Windows): Follow this link, and choose the option ‘Community’.
For Mac: Follow this link, and choose the option ‘Community’.
After installation, you will see the following window after opening Intellij:
You can ignore the existing projects, since you will start with no existing projects.
To add the Python Plugin:
- Click on ‘Configure’ at the lower right corner.
- Choose option ‘Plugins’. A new Plugins window will open.
- In the upper left corner, type in ‘Python’.
- Install the Python Plugin.
Python SDK: Conda offers many tools for Python 3 development and has a built in Python SDK. It is also free. If disk space is not an issue for you, I recommend downloading Conda and using it’s SDK.
Conda’s functionality will not be clear for this project, but if you continue using Python 3, it will help you a great deal.
Installing Conda (For Windows): Follow this link.
For Mac: Follow this link.
Now you are set to start a new Python Project.
 Create Project
Return to the Welcome Window, and this time click on ‘Create New Project’. A new window ‘New Project’ will open. In the left list of project types, select ‘Python’.
It should look similar to this (Except you will not have a Project SDK selected! We will get to that next):
Now you will need to setup the Python SDK from Anaconda for the project. Next to ‘Project SDK: ‘ you will see in the top right corner, a button ‘NEW…’. Click the button.
You will now see a window that looks similar to this (but with not Environment configured yet):
Now select ‘Virtualenv Environment’ in the left option list, and click on ‘New environment’. Next to ‘Base interpreter’ you will need to give the path to the python interpreter of Anaconda, that you downloaded. In windows, the path should be similar to: ‘C:\Users\<USER>\Anaconda3\python.exe’.
Now click OK, then ‘NEXT’, then ‘NEXT’ again. For consistency, we will name our project ‘BulkDownloader’. Also set ‘Project location’ to a location of your choice, but just be sure the location path ends with ‘BulkDownloader’ as well. Do not update the ‘More Settings’ at the bottom, they auto-update to the correct values.
It should look like this:
now click ‘FINISH’ and wait a bit for the IDE to load the new project.
 Add Packages to SDK
In the top bar, under File, you will find the ‘Project Structure’. Click on it, then choose SDKs.
After the SDK is added, go to ‘Packages’, and add the following libraries to the SDK (from + sign):
‘selenium’, ‘urllib ‘ and ‘unittest’.
 Setting up ChromeDriver
You will see attached to this tutorial a file chromedriver.exe, put the file in a permanent location, be sure that the path to it does not include spaces or special characters and then change the path to your location (instead of ‘C:’). NOTICE: For some machines, only the latest version of ChromeDriver.exe work. So you might want to download the file yourself from here.
Mac / Linux:
You will need to download the latest chromedriver file from here. After you download the file, put the file in a permanent location, be sure that the path to it does not include spaces or special characters and then change the path to your location.
 Setting up Source Code
You will see attached to this tutorial the source code for the project. This is the actual code that runs the program. After you unzip the downloaded file, open ‘BulkDownloadProject’ folder, and open all Python (.py) files with your editor of choice.
Now create under your own project ‘BulkDownloader’, new Python files using rightclick on the project name. Name the files exactly the same as the Python files in the unzipped
‘BulkDownloadProject’ folder, and copy the content of the unzipped project files into the files with the same names, you just created.
 Running Project
Finally, you will need a new ‘Run Configuration’.
In top bar, under ‘Run’, you will see the ‘Edit configurations’ option. Create a new Python tests > UnitTest configuration and give it the path to the run.py file.
 Additional Resources
There are many great tutorials out there for Python. I recommend this Udemy Course in particular.
The Selenium Library
You will notice I use Selenium (Together with PyTest and UnitTest) for these tests. In short, Selenium is a library that allows you to mimic user actions, as well as get elements from the DOM. The most important object to know about is the ‘driver’, which can be thought as a real driver, navigating web pages, searching for specified elements and clicking them, setting values, etc.