How Handling ‘Cookies’ Helps With Simultaneous Access To Web Applications

How handling ‘Cookies’ helps you deal with multiple users accessing the web application on the same browser at the same time.

As an Automator, you are required to provide efficient solutions to  your clients’ testing automation concerns. That means continuously looking for possible ways via simple to complex research, team discussion and hands-on experience to provide a practical resolution for them. Don’t worry, you’re not alone!

A few months back, our consultant worked with a client and one problem they had to deal with was a test automation requirement that should handle two users accessing the same web application on the same browser session simultaneously. In this article, you will learn how to achieve this usecase with the use of browser cookies.

Let’s take a quick look at the requirement!

There are two users (a customer and a merchant) who needs to log into to the same web application. The merchant is initially logged in to perform his tasks as a seller such as fetching the customer details, checking the initial purchase status, and sending details to the customer. In the new browser window (tab), the customer needs to be logged in as well to handle the completion of payment details. Then, the merchant needs to go back to its window to check the purchase status has been changed in real time without the hassle of signing in again through the web interface.

Alright! So, what’s the issue here?

In automation, this scenario would entail login issues for both the merchant and the customer. Different users cannot simply log into the same application using the same browser window. This is only possible when the developer who built the application made a workaround to maintain multiple authenticated sessions in the same browser or the users will make use of private (incognito) and non-private browser windows to access the application. Unfortunately, this is not true for this case.

But Hooray! The ‘cookies’ functionality can support us…

Cookies are an important browser feature. These are small pieces of information websites store on your computer which possibly include session IDs. These websites use cookies to recognise and identify you. If cookies are not stored, you will need to constantly perform a login action as a pre-requisites before you can proceed with other test steps.

With the cookies functionality, we can simply save and remove user sessions that would allow users to access the same application. Given this, we can apply the following cookies-related codes to our selenium tests.


To conclude, you can aid the problem with multiple users concurrently accessing the web application on the same browser and re-entering login details by using the session cookies functionality.