[2021 version] From Selenium Basic installation to Web scraping execution by Python Windows 10 (64bit)

Introduction

Since there are many opportunities to install Selenium Basic, I made it a manual. This article is for Windows 10 (64bit) users who want to do web scraping with Python.

Please refer to the following article for how to install Python. https://qiita.com/ssbb/items/b55ca899e0d5ce6ce963

Web browser requirements

This time, we will use Google Chrome for web scraping, so please install Google Crome in advance.

What is Selenium Basic?

The official Selenium Basic website (https://florentbr.github.io/SeleniumBasic/) explains as follows. In short, it's okay to think of it as a file needed for web scraping.

Description It makes it possible to automate web browsing using Excel and VBA code or using a simple VBS file executed by double-clicking on it. User's actions can be recorded using the Firefox plugin named "Selenium IDE" and translated to VBA or VBS with the provided formatters.

Selenium Basic installation

Go to the Selenium Basic official website (https://florentbr.github.io/SeleniumBasic/) and click [Release page] in the middle of the page. 1.png

Click the exe file to download it. 2.png

When the download is complete, launch the exe file. When the Welcome to the Selenium Basic Setup Wizard and the Setup Wizard appear, click Next. 3.png

You will be asked to accept the license. Check [I accept the agreement] and click [Next]. 4.png

Leave the default components to install and click Next. 5.png

If you are satisfied with the installation contents, click [Install]. 6.png

If [Completing the Selenium Basic Setup Wizard] is displayed, the installation was successful, so click [Finish] to close it. 7.png

ChromeDriver installation

The web driver for Google Chrome included with Selenum Basic is not compatible with the latest version of Google Chrome. Therefore, download the Chrome Driver with the same version as your Google Chrome from the following page.

ChromeDriver - WebDriver for Chrome https://sites.google.com/a/chromium.org/chromedriver/downloads

The version of Google Chrome I'm using is "87.0.4280.88", so click "Chrome Driver 87.0.4280.88". 8.png

Since the Windows version of Chrome Driver is required, click "chromedriver_win32.zip". 9.png

After the download is complete, unzip the zip file and place "chromedriver.exe" in any directory.

(Example) Create a folder called "ChromeDriver" directly under the C drive and place "chromedriver.exe" 10.png

Install Selenium library for Python

Start the command prompt and execute the following command.

pip install selenium

If [Successfully installed selenium] is displayed, the installation is successful. 11.png

Operation check

Start the command prompt and execute the following command. [executable_path] should be the directory path where the Chrome Driver is located.

python
from selenium import webdriver
webdriver.Chrome(executable_path=r'C:\ChromeDriver\chromedriver.exe')

12.png

After outputting [DevTools listening on ws ... (omitted)], if the browser is started for a while, it is successful. 13.png

Finally

The methods used in actual web scraping are summarized below, so I hope you find it helpful.

[2021 version] Python + Selenium Frequently used operation method summary https://qiita.com/ssbb/items/306ec9a1dbecd77d001b

Thank you for reading to the end!

Recommended Posts

[2021 version] From Selenium Basic installation to Web scraping execution by Python Windows 10 (64bit)
[2021 version] Python installation Windows 10 (64bit) edition
[Python] Flow from web scraping to data analysis
Python web scraping selenium
Web scraping using Selenium (Python)
[Python] Introduction to scraping | Program to open web pages (selenium webdriver)
Scraping with Selenium in Python (Basic)
Python (from first time to execution)
Getting Started with Poetry From installation to execution and version control
[Python] Warning came out when I raised from Selenium 3 to 4 [Web Driver]
Try using the Python web framework Django (1)-From installation to server startup
Practice web scraping with Python and Selenium
Call a command from Python (Windows version)
Introduction to Scapy ① (From installation to execution of Scapy)
WEB scraping with python and try to make a word cloud from reviews
How to open a web browser from python
I tried web scraping using python and selenium
[Ansible installation procedure] From installation to execution of playbook
From ROS for Windows installation to operation check
I want to sell Mercari by scraping python
From easy git installation to docker startup python
Python installation (Windows)
PYTHON2.7 64bit version
Beginners can use Python for web scraping (1) Improved version
I was addicted to scraping with Selenium (+ Python) in 2020
How to download files from Selenium in Python in Chrome
Python development environment construction 2020 [From Python installation to poetry introduction]
Python basic course (2 Python installation)
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Python installation method Windows
Introduction to Web Scraping
python basic on windows ②
Scraping with Selenium [Python]
From editing to execution
Python Basic Course (3 Python Execution)
Call the code generated by Cython from C / C ++ (Windows version)
Scraping desired data from website by linking Python and Excel
I tried changing the python script from 2.7.11 to 3.6.0 on windows10