Member-only story

Angular | Selenium

How To Setup Selenium in an Angular Project

Keep your Angular app and Selenium tests in the same workspace and run them using Mocha

Kagklis Vasileios
Better Programming
Published in
6 min readSep 14, 2022

--

Photo by Chait Goli: https://www.pexels.com/photo/photo-of-teepee-under-a-starry-sky-2666598/

In this article, we will study how to set up Selenium in Angular. More specifically, we are going to do the following:

  • set up Selenium by using npm to install Selenium’s WebDriver and the required browser drivers
  • create a second project to keep tests in the same workspace with the application under test
  • create a running command to run selenium tests using Mocha
  • create and run an example selenium test for a demo application
  • review the generated report

So, let’s get started!

Disclaimer: This article focuses mainly on how to set up and use Selenium in an Angular project. Some familiarity with Selenium and its terminologies is preferable but not mandatory.

Setting Up Selenium in Angular

Firstly, we need to install the required dependencies for Selenium by running:

npm install --save-dev selenium-webdriver @types/selenium-webdriver mocha @types/mocha mochawesome @types/mochawesome…

--

--

Responses (1)

Write a response