Selenium
Install Python, Pip, and Selenium
First you will need to set up Selenium to run with Python.
- Install Python, either through their website or through the Microsoft Store.
- Make sure to install it for all users. It will install Python under C:\Python###
- Also check the option to install the environment variables for you automatically.
- Install
pip
. - Then install
selenium
by runningpip install selenium
. See also pypi.
Set Up in VS Code
With the dependencies installed, we’ll want to make sure we can run the scripts in VS Code. These articles are helpful.
- Install the VS Code Python extension.
- Create a virtual environment. This is best practice for Python developers.
- Open the Command Palette
Ctrl+Shift+P
, start typing thePython: Create Environment
command to search, and then select the command. - Select
Venv
as the environment. - Then select the interpreter to use. Make sure to use the correct version.
- Open the Command Palette
- Create a file, for example
hello-world.py
. Include some code, such as:msg = "Roll a dice" print(msg)
- Click run to make sure it runs.