Drive WebDriver with python

Purpose

Drive WebDriver with python. Do as much as you can start Edge.

Environment

Work in an environment where the python installation is complete. When I checked the version, it was the following version. Python 3.8.0

selenium import

Execute the following command. If necessary, run it on the command line with administrator privileges.

pip install selenium

Run by python

Check the operation to see if selenium could be imported.

Script creation

Create a script.

webdriver_sample.py


from selenium import webdriver

#Get Edge Driver
driver = webdriver.Edge()
#Transition to the specified URL
driver.get("https://www.google.co.jp")

Run

Let's run the script.

python .\webdriver_sample.py

Since it is before the environment is built, an error will occur.

selenium.common.exceptions.WebDriverException: Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687

I heard that the path to WebDriver does not pass, but I have not installed it yet, so it is as expected.

Install Edge Driver

Install Edge Driver.

Check Edge

Check in Settings → General. My Edge was the following version. Microsoft EdgeHTML 18.18362

Check the setting method at the following URL. http://go.microsoft.com/fwlink/?LinkId=619687

Since 18 it is built into Windows 10 and seems to be automatically updated. It seems that you can use it by enabling [Developer Mode].

Developer Mode Settings

Change the settings with administrator privileges. Settings → Updates and Security → For Developers Sets the radio button for developer mode.

Run by python

Confirm that WebDriver has been set.

Run in python

Let's run the script.

python .\webdriver_sample.py

This time I started the browser.

About [Developer Mode]

Once you have installed WebDriver, you can restore it from [Developer Mode] without any problem.

Recommended Posts

Drive WebDriver with python
Access Google Drive with Python
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
My Webdriver (Python)
Excel with Python
Microcomputer with Python
Cast with python
Use selenium phantomjs webdriver with python unittest
Upload images to Google Drive with Python
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Learning Python with ChemTHEATER 03
Sequential search with Python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Run prepDE.py with python3
1.1 Getting Started with Python
Collecting tweets with Python
Binarization with OpenCV / Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Posting tweets with python
Use mecab with Python3
[Python] Redirect with CGIHTTPServer
Voice analysis with python
Think yaml with python
Operate Kinesis with Python
Getting Started with Python
Use DynamoDB with Python
Zundko getter with python
Handle Excel with python
Ohm's Law with Python
Primality test with python
Run Blender with python
Solve Sudoku with Python