This is the main repository for the course Test automation with Selenium created by Conrec Infinity where we will learn how to use Selenium and Python to test web pages.
Installation instructions will be targeted for the Windows platform but using Mac OSX or Linux will also work. Some instructions will need some tweaking. The examples and lectures will focus on Python but can be applied to other languages like C# and Java too.
Download the Python executable from http://python.org and run setup.
Select Install Now to install and use default installation path and options or select Customize installation if you want to customize the settings. Select the option Add python.exe to PATH so we can use Python from any folder location later on.
Verify Python setup by opening a Command prompt or Powershell terminal and write the following commands:
python --version
Result: Python 3.x.y
pip --version
Result: pip 2x.y.z
Download GIT (64-bit version) from https://www.git-scm.com and run setup. There is a lot of options but I recommend to use default options for now.
Verify GIT setup by opening a command prompt or Powershell terminal and write the following commands:
git --version
Result: git version 2.x.y
Optional - Setup your name and e-mail to use when pushing code to a repository:
git config --global user.name "Your name"
git config --global user.email your@email.xyz
Download the VSCode executable from https://code.visualstudio.com and run setup.
Default options is enough but if you want to start VS Code from any folder location then select the option Add to PATH (requires shell restart).
Start Visual Studio Code and click on the extensions to the left of VS Code window and search for Python and install the Python extension from Microsoft - IntelliSense (Pylance) ...
Also install the Live Server extension which will be used to test local web pages.
Open a command prompt or Powershell terminal and create a folder where you want the Selenium project to reside:
mkdir ConrecInfinity
cd ConrecInfinity
Run the following command to download this repository:
git clone https://github.com/Conrec-Infinity-AB/Selenium-Course.git
A warning will appear, just answer Yes to the question.
The authenticity of host 'github.com (140.82.121.3)' can't be established.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
In VS Code select Open folder and select the folder Selenium-Course where the repository was cloned to.
If a warning is visible about trust of the files and folder is visible then select Yes, I trust the authors.
When we work with different Python projects it's always a good practise to create a virtual environment for the project we are working with so we don't install Python packages globally.
After we have openend our Selenium-Course project In visual Studio Code, open the Command Palette by using CTRL + SHIFT + P or selecting it in the View Menu
Search for Python: Create Environment.. and select it.
In the dropdown select the option Venv
Select the Python 3.x.y Python interpreter.
Select the requirements.txt file and OK
The virtual environment will be created and the Python packages used in this course will be downloaded.
Open the file ./Lecture1/code/1_openingPage.py and run it by selecting Run / Run without debugging in the menu. If everything is setup correct then a Chrome web browser should open and close.
The text below should be visible in Viual Studio Code terminal:
Title is: Home Page
-
Course recordings Here you find all the recordings from lessons 1-3(4). Note that you need to be logged in to Conrec Office 365.
-
Our test site online This is hosted on Githubs pages. Will be redeployed every time we check in code in this repository. This is the site we will run our test on.
-
Our test site offline Use the extension Live Server and start index.html page in the ./docs folder. Use this one if you are offline or want to test changes locally before commiting to the repository.
-
Selenium documentation Everything related to Selenium APi and Grid and more
-
Python language bindings for Selenium WebDriver Python bindings for Selenium 4
-
Selenium with Python Good site for more examples, API calls and exceptions and more
-
Python documentation Everything related to the Python language
-
Python Package Index The repository for Python packages which can be imported, including instructions how to install them with the pip command
-
Pytest documentation Here you find everything related to Pytest
-
Selenium Package Selenium Pip install instructions and basic usage examples
-
Virtual environments How to setup and use virtual environments in Python
-
Google DevTools Googles developer tool used in Chrome webbrowser. A tool you should be comfortable with when writing Selenium tests
-
Google Chrome command switches A comprehensive list of command options for Google Chrome
-
Softwaretestingboard A site which can be used for tests
-
Saucedemo Another site which can be used for running tests against