Github Integration with Selenium: Complete Tutorial

โšก Smart Summary

GitHub integration with Selenium places the automation project in one shared remote repository, so every team member pulls the same code and Jenkins builds each change directly from that repository without any manual copying.

  • ๐Ÿ”˜ Prerequisites: Jenkins, Maven and Tomcat must be installed before the Git and GitHub setup begins.
  • โ˜‘๏ธ Git Binaries: The Windows installer sets the PATH, SSH client and line-ending rule.
  • โœ… Jenkins plugin: Install the GitHub plugin from the plugin manager, then restart before it appears.
  • ๐Ÿงช Eclipse EGit: Share Project creates the local repository; Commit and Push send code to GitHub.
  • ๐Ÿ› ๏ธ Jenkins job: A Maven job points at the repository URI and the pom.xml path.
  • โš ๏ธ Authentication: GitHub no longer accepts passwords for pushes, so use a token or SSH key.

GitHub integration with Selenium

What is GitHub?

GitHub is a collaboration platform built on top of Git. It allows you to keep both a local and a remote copy of your project, so a project can be published among team members who use and update it from there.

Advantages of using GitHub for Selenium:

  • When multiple people work on the same project they can update project details and inform other team members simultaneously.
  • Jenkins can regularly build the project from the remote repository, which helps us keep track of failed builds.

Prerequisite for Selenium and GitHub Integration

Before we start Selenium and GitHub integration, we need to install the following components.

  1. Jenkins installation
  2. Maven installation
  3. Tomcat installation

You can find the installation steps in the following guides:

  1. Maven and Jenkins installation guide
  2. Tomcat installation guide

The screenshot below shows the Selenium Maven project we will share to GitHub.

Selenium project files listed in the Eclipse package explorer before Git integration

Git Binaries Installation

Now let us start by installing the Git Binaries.

Step 1) Launch the browser and navigate to https://git-scm.com/

Step 2) Download the latest stable release.

Step 3) Click on the download for Windows, then begin the installation.

Git for Windows download page on the git-scm.com website

Step 4) Go to the download location or icon and run the installer.

Step 5) Click through the welcome screen and the General Public License.

Step 6) Click on the next button in the Git setup wizard.

Git setup wizard welcome screen for the Git Binaries installer

Step 7) Read the GNU General Public License and click on next.

GNU General Public License page of the Git for Windows setup wizard

Step 8) In the next window,

  1. Select the directory where you want to install the Git Binaries, and
  2. Click on the next button

Choosing the destination directory for the Git Binaries installation

Step 9) Select the components you want to install and click on next.

Selecting which Git components to install in the setup wizard

Step 10) If you want to create a start menu folder for Git, leave the setting default and click on next.

Choosing the Start Menu folder name for the Git shortcuts

Step 11) In this step,

  1. Select Use Git from the Windows Command Prompt so Git runs from the command line, and
  2. Click on next, leave the default setting and click next again.

Selecting Use Git from the Windows Command Prompt in the PATH environment step

Step 12) In this step,

  1. Select Use OpenSSH. It lets us run the command from the command line and sets the environment path.
  2. Click on the next button.

Selecting Use OpenSSH as the SSH executable in the Git setup wizard

Step 13) In this step,

  1. Select “Checkout Windows-style, commit Unix-style line endings” (this controls how Git should treat line endings in text files).
  2. Click on the next button.

Choosing the Checkout Windows-style commit Unix-style line ending option

Step 14) In this step,

  1. Select Use MinTTY, the default terminal of MSys2, for Git Bash
  2. Click on the next button

Selecting MinTTY as the default terminal emulator for Git Bash

The installer then copies the files across.

Git setup wizard installation progress bar

Open the command prompt, type “git” and hit Enter. The screen below confirms a successful installation.

Command prompt showing the git command output after a successful installation

Jenkins Git Plugin Install

With Git installed, Jenkins needs its own plugin to read a GitHub repository.

Step 1) Launch the browser and navigate to your Jenkins.

Step 2) Click on Manage Jenkins.

Jenkins dashboard with the Manage Jenkins link in the left navigation

Step 3) Click on Manage Plugins. It will open another window.

Manage Jenkins page showing the Manage Plugins entry

Step 4) Click on the Available tab.

Available tab of the Jenkins Plugin Manager

Step 5) In this step,

  1. Select the GitHub plugin, then
  2. Click on the Download now and install after restart button.

Selecting the GitHub plugin and clicking Download now and install after restart

โš ๏ธ Current Jenkins UI: the entry is now Manage Jenkins > Plugins and the tab is Available plugins. The screens keep the older labels; the actions are unchanged.

Jenkins now installs the GitHub plugin and its dependencies. Once finished, restart your Tomcat server by calling the shutdown.bat file.

Jenkins installing the GitHub plugin and its dependencies

After restarting Tomcat and Jenkins we can see the plugins listed in the Installed tab.

Installed tab of the Jenkins Plugin Manager confirming the GitHub plugin

Setting Up our Eclipse with GitHub Plugin

The update site for the EGit plugin is https://download.eclipse.org/egit/updates/

โš ๏ธ Version note: Eclipse IDE for Java Developers now bundles EGit. Check Window > Show View > Git first and skip this section if the view already exists.

Step 1) Launch Eclipse and then

  1. Click on the Help menu, then
  2. Click on Install New Software

Eclipse Help menu with the Install New Software option selected

Step 2) The screen below opens once we click on Install New Software. Now click on Add.

Eclipse Install New Software dialog before adding a repository

Step 3) In this step,

  1. Type the name “EGIT” and
  2. Enter the location https://download.eclipse.org/egit/updates/, then
  3. Click on OK.

Adding the EGit update site name and location in Eclipse

Step 4) Then click on Select All and next.

Selecting all EGit features in the Eclipse install wizard

Step 5) Click on next, accept the license agreement, then finish the installation and restart Eclipse.

Accepting the EGit license agreement in Eclipse

Building a repository on Git

Step 1) Navigate to https://github.com/ and sign up for GitHub.

Step 2) Once you have successfully signed up, click on create new repository.

GitHub Create a new repository page

Step 3) In this step,

  1. Enter the name of the repository, and
  2. Click on Create repository

Naming the new GitHub repository and clicking Create repository

Testing Example Of Using Selenium with GitHub

Step 1) Once we are done with the new repository, launch Eclipse.

  1. Click on File
  2. Then click on New, and then
  3. Click on Other

Eclipse New wizard with the Other option selected

Step 2) In this step,

  1. Select Maven Project and browse the location.
  2. Click on next

Selecting Maven Project in the Eclipse New Project wizard

Step 3) In this step,

  1. Select the project name and location, then
  2. Click on next

Choosing the Maven project name and workspace location

Step 4) Click on next.

Selecting the Maven archetype for the new project

Step 5) In this step,

  1. Enter Group Id and
  2. Artifact Id, and
  3. Click on the Finish button.

Entering the Maven Group Id and Artifact Id for the project

As soon as you click on the Finish button, a project will be created.

Step 6) Now let us create a sample script.

Sample Selenium test script created inside the new Maven project

Step 7) Now push the local repository to GitHub.

  1. Open Eclipse and then navigate to the project
  2. Right-click on the project and select Team, then
  3. Select Share Project

Eclipse Team menu with the Share Project option

Step 8) Clicking Share Project opens another window. In this step,

  1. Select the local repository, and
  2. Click on Finish.

Configure Git Repository dialog with the local repository selected

Once we click on Finish, the project structure changes to show that a local repository was created.

Eclipse package explorer showing the project after the local repository is created

Step 9) In this step,

  1. Right-click on the project and Team, then
  2. Click on Commit

Eclipse Team menu with the Commit option selected

Step 10) In this step,

  1. Enter a commit message and
  2. Select the files we want to send to the GitHub repository
  3. Click on Commit and Push

Git staging view with a commit message and the files selected for commit and push

โš ๏ธ Authentication note: GitHub stopped accepting account passwords for Git operations in August 2021. Supply a personal access token with the repo scope instead, or configure an SSH key.

The project icons then change, showing that the code was committed and pushed to GitHub.

Eclipse project icons updated after a successful commit and push

The GitHub repository confirms the project was pushed.

GitHub repository page showing the pushed Selenium project files

Now we execute the project from GitHub in Jenkins.

Step 11) Launch the browser and open your Jenkins.

Step 12) Click on New Item.

Jenkins dashboard with the New Item link

Step 13) In this step,

  1. Enter the item name
  2. Select Maven Project
  3. Click on the OK button

Entering the item name and selecting Maven Project in Jenkins

Step 14) In this step, we will configure GitHub in Jenkins.

  1. Click on Git, and
  2. Enter the repository URI
  3. Click on Add Repository

With multiple repositories in GitHub, add the name in the Refspec field.

Jenkins source code management section configured with Git and the repository URI

We can get the URI from the GitHub repository page.

Copying the repository URI from the GitHub repository page

Step 15) In this step,

  1. Add the pom.xml file location in the textbox and
  2. Specify the goals and options for Maven, then
  3. Select the option for how to run the test
  4. Click on the Save button.

Jenkins build section with the pom.xml location and Maven goals

Step 16) The screen below appears. Build the project by clicking on Build.

Saved Jenkins job page with the Build Now option

Step 17) It will show the build. Click on the build number or the build date.

Jenkins build history showing the new build number and date

Step 18) The screen below appears. Click on Console Output.

Jenkins build page with the Console Output link

Finally, we can verify that our build completed successfully. The same job can then feed a CI/CD pipeline or a freestyle project.

Jenkins console output confirming the build finished successfully

FAQs

GitHub removed password authentication for Git operations in August 2021. Create a personal access token with the repo scope and use it instead of the password, or switch the remote to SSH.

No. New repositories default to main. If Jenkins reports that the branch does not exist, change the Branch Specifier in the job from */master to */main.

Poll SCM checks the repository on a cron schedule. A GitHub webhook pointing at your Jenkins URL triggers a build the moment a push lands, which is faster and cheaper.

AI-assisted analysis reads the console output, clusters failures by shared stack traces and separates real regressions from environment noise. Some plugins also predict which commit broke the build.

GitHub Copilot drafts declarative stages quickly, but check them against your own Jenkins pipeline setup, because suggested plugin names are often outdated.

Usually not. Eclipse IDE for Java Developers has shipped with EGit for years. Check Window then Show View then Git first; the manual install matters only for a minimal Eclipse package.

Git is the version control tool on your machine that records commits. GitHub is a hosting platform built on Git, adding remote repositories, pull requests, issues and team access control.

Add a .gitignore covering target, .settings, .project, .classpath and any credentials file. Committing build output and IDE metadata causes merge conflicts and enlarges the Jenkins checkout.

Summarize this post with: