Try running Google Chrome with Python and Selenium

Try running Google Chrome with Python and Selenium


-I tried it on Mac while watching Official Tutorial. ――There was a part that was a little clogged, so make a note.

Tried environment


Install Python library

pip install -U selenium

Install browser driver

The driver will download what you need according to the browser version you are using. Even if I updated my browser, I didn't have to install the latest version of the driver. (Please note that the version is different if you look closely) I put it in the same location as the directory where I run the program.

vaivailx@MacBook-Pro-2 selenium_test % tree.
├── chromedriver

0 directories, 3 files
vaivailx@MacBook-Pro-2 selenium_test %

The following may differ from person to person or depending on the environment even on the same Mac. If you get a word that you can't execute the downloaded one, please try it. After downloading and unzipping the driver, open "Security & Privacy" in "System Preferences". When you execute the unzipped file, you will be asked whether to allow execution in the "Execution permission of downloaded application" item, so allow it.

Run the sample program

The Official Tutorial is written with a path to the location where the driver is located.

However, it seemed that I had to pass the path where the driver is located when creating an instance of the driver class, so I tried specifying the path.

from selenium import webdriver

browser = webdriver.Chrome(executable_path="./chromedriver")



When operating the browser with selenium, when it is chrome, it says "Chrome is controlled by automatic test software."

I did not know.

Recommended Posts

Try running Google Chrome with Python and Selenium
Try running Python with Try Jupyter
Install selenium on Mac and try it with python
Automate Chrome with Python and Selenium on your Chromebook
Robot running with Arduino and python
Scraping with Python, Selenium and Chromedriver
Selenium and python to open google
Try using Python with Google Cloud Functions
Practice web scraping with Python and Selenium
[Machine learning] Try running Spark MLlib with Python and make recommendations
Try to display google map and geospatial information authority map with python
Try scraping with Python.
Automatic operation of Chrome with Python + Selenium + pandas
Drag and drop local files with Selenium (Python)
ScreenShot with Selenium (Python)
Scraping with Selenium [Python]
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
Try out the touch of data-driven testing with Selenium Python Bindings and py.test
Try to operate DB with Python and visualize with d3
Automatic follow on Twitter with python and selenium! (RPA)
How to switch to smartphone mode with Python + Selenium + Chrome
Automatically translate DeepL into English with Python and Selenium
Encryption and decryption with Python
Scraping with selenium in Python
Python and hardware-Using RS232C with Python-
Scraping with Selenium + Python Part 1
Try Google Mock with C
Try Python output with Haxe 3.2
Study Python with Google Colaboratory
Python: Working with Firefox with selenium
Try running CNN with ChainerRL
Scraping with Selenium in Python
Scraping with Selenium + Python Part 2
python with pyenv and venv
Access Google Drive with Python
Try Selenium Grid with Docker
Try face recognition with Python
Try OpenCV with Google Colaboratory
Challenge Python3 and Selenium Webdriver
Works with Python and R
Selenium-Screenshot is useful for screenshots of web pages in Python3, Selenium and Google Chrome
Try running python in a Django environment created with pipenv
Try Amazon Simple Workflow Service (SWF) with Python and boto3
Try to bring up a subwindow with PyQt5 and Python
[Selenium] Print without header and footer (forced) [Python / Chrome Driver]
Shining life with Python and OpenCV
Try scraping with Python + Beautiful Soup
Neural network with OpenCV 3 and Python 3
AM modulation and demodulation with python
[Python] font family and font with matplotlib
Scraping with Node, Ruby and Python
Try to operate Facebook with Python
Try singular value decomposition with Python
Scraping with Python and Beautiful Soup
JSON encoding and decoding with python
Hadoop introduction and MapReduce with Python
[GUI with Python] PyQt5-Drag and drop-
Reading and writing NetCDF with Python
Try face recognition with python + OpenCV
Try running Jupyter with VS Code
I played with PyQt5 and Python3