Getting Started

Watch the getting started video (5 min):

Why should I use BlinqIO?

BlinqIO offers a new effective way for configuring test environments for selenium, removing repetitive configuration efforts and reducing errors. In this version BlinqIO enables to configure a test environment bypassing the login process.

There are several advantages to bypass the application login screen:

  1. tests run faster.
  2. no need for complex authentication scenarios such as multi-factor, captcha and more.
  3. tests can run on a production environment without the need to create a backdoor.

In this Getting Started section we will take you through a step-by-step tutorial to install and use BlinqIO open source free software. Once you have completed the installation process you will be able to easily configure your test environment bypassing the login process.

Note that support for the Selenium Session Manager and its components is available in the BlinqIO forum: https://community.blinq.io/

System requirements

System requirements: Your selenium project should be using Selenium 4.x or greater. This version is required due to the use of the DevTools capabilities available in this version. The solution will work only for browsers that support DevTools capabilities.

Estimated installation time: 10 min

Solution components

The Seleniun Session Manager installation process comprises of three parts: installing the Selenium Session Server (SSS), installing the Selenium Session Connector (SSN) and adding the Selenium Session Client (SSC) to your selenium project.

  1. Selenium Session Connector (SSN) – a Chrome extension that enables to copy the session information and store it in the Selenium Session Server (https://github.com/blinq-io/selenium-session-manager/tree/master/extension).
  2. Selenium Session Server (SSS)- a server that store all the session cookies (https://github.com/blinq-io/selenium-session-manager/tree/master/server).
  3. Selenium Session Client (SSC) – a client that integrates into your tests, retrieves the session information from the Selenium Session Server and applies the session cookies into the running selenium browser (https://github.com/blinq-io/selenium-session-manager/tree/master/clients).

Installation process

Step 1: Install the Selenium Session Connector (SSN)

Navigate to the chrome store.

Install the Selenium Session Connector (SSN). Following is a link to the SSN:

https://chrome.google.com/webstore/detail/selenium-session-connecto/fedcmiifkeclkmhgclkicjoklealdlnm

Once installed, launch the extension. The first time you launch the extension you will be prompted to provide the ‘session server’ URL. In our case we can use http://localhost:3000

Once you have entered the session server URL as described above click the Save changes button.

Step 2: Install the Selenium Session Server (SSS)

The Selenium Session Server stores your sessions (saved by the Selenium Session Connector, i.e. the chrome extension), that then can be accessed by your selenium tests to retrieve the session cookies. Note that support to the Selenium Session Manager and its components is available at the BlinqIO forum: https://community.blinq.io/ .

There are two options to install the SSS: as npm package or a dockerized version.

Option 1: npm package

Get the server as npm package (npm):

npm install -g selenium-session

Once installed, run the server using:

selenium-session
Option 2: dockerized version

Download a dockerized version (docker hub) and run it:

docker run -v ${PWD}/sessions:/usr/app/sessions -it -p 3000:3000 devblinq/selenium-session

Step 3: Install the Selenium Session Client (SSC)

The Selenium Session Client integrates into your tests, retrieves the session information from the Selenium Session Server and applies the session cookies into the running selenium browser.

BlinqIO offers four available SSCs: Java SSC, JavaScript SSC, Python SSC and C# SSC. Following are the installation instructions for each of these SSCs.

C# Client:

Prerequisites

.Net 6.0 SDK installed

To Build

dotnet build

To upload to nuget.org

dotnet nuget push src\SeleniumSessionClient\bin\Debug\SeleniumSessionClient.<version>.nupkg –api-key API_KEY –source https://api.nuget.org/v3/index.json

How to add it to your tests

Nuget

To add the dependencies into your project:

PM> Install-Package SeleniumSessionClient

Code example

Following is a code example to integrate it into your C# Selenium tests:

ChromeDriver driver = new ChromeDriver(); // Make sure chromedriver is in your path
    await SeleniumSessionClient.SeleniumSessionClient.initSession(driver, new string [] { "github"});
    driver.Url = "https://github.com";
    Thread.Sleep(5000);
    driver.Close();
Java Client:

How to add it to your tests

Gradle:

implementation group: 'io.blinq.SeleniumSessionClient', name: 'SeleniumSessionClient', version: '1.0.0'

Maven:

<dependency>
    <groupId>io.blinq.SeleniumSessionClient</groupId>
    <artifactId>SeleniumSessionClient</artifactId>
    <version>1.0.0</version>
</dependency>

Code example

Following is a code example to integrate it into your Java Selenium tests:

import io.blinq.session.SeleniumSessionClient;
import org.openqa.selenium.chrome.ChromeDriver;

public class SeleniumTest {
    public static void main(String...args) throws Exception{
        System.setProperty("webdriver.chrome.driver","chromedriver.exe");
        ChromeDriver driver = new ChromeDriver();
        SeleniumSessionClient.initSession(driver, "github");
        driver.get("https://github.com/");
        Thread.sleep(5000);
        driver.quit();
    }
}
Javascript Client:

How to add it to your tests

To install the Javascript client, run:

npm install selenium-session-client

Code example

Following is a code example to integrate it into your Javascript Selenium tests:

import { Builder } from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome.js';
import * as seleniumSessionClient from 'selenium-session-client';

let service = new chrome.ServiceBuilder('./chromedriver').build();
chrome.setDefaultService(service);
let driver = new Builder().forBrowser('chrome').build();

await seleniumSessionClient.initSession(driver, ['github']);
await driver.get('https://github.com');
Python Client:

How to add it o your test:

To add the dependencies into your project, PIP:

pip install selenium-session-client

Code example

Following is a code example to integrate it into your Python Selenium tests:

import os
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium_session_client.session_client import init_session

def test():
    driver = webdriver.Chrome('chromedriver')
    init_session(driver, ['github'])
    driver.get("https://github.com/")
    sleep(5)
    driver.quit()

test()

Using BlinqIO SSM in your selenium tests

Now that you have completed the installation process, you are all set to start using the BlinqIO SSM. Following is a quick guide of how to use the SSM with your selenium tests:

  1. Open your chrome browser, and navigate to the URL you would like to use in your tests.
    In the example below we use https://github.com
  2. Login to the site.
  3. Open the Selenium Session Connector (SSC)
  4. Click on ‘Capture Session’
  5. Set the tags (note – you can set multiple tags using a comma). In the example below we will use ‘github’ as the tag.
  6. Click Save to store the session under the provided tag/tags in the Selenium Session Server (SSS).

Now it’s time to use the stored session in the code of the tests.

javascript:

await seleniumSessionClient.initSession(driver, [‘github’]);
await driver.get(‘https://github.com’);

Java:

        SessionClient.initSession(driver,”github”);
        driver.get(“https://github.com/”);

Python:

    init_session(driver, [“github”])
    driver.get(“https://github.com/”)

C#:

        SessionClient.initSession(driver, new string [] { “github”});
        driver.Url = “https://github.com”;