# Is it possible to have two browsers with different sessions in one test case?

**URL:** <https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [June 15, 2018, 9:25am UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550 "2018-06-15T09:25:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magyar\_Zoltan](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Magyar\_Zoltan](https://forum.katalon.com/u/Magyar_Zoltan)\
**Post date:** [June 15, 2018, 9:25am UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/1 "2018-06-15T09:25:36Z")

</div>

I need to profiles signed-in in one website where they can communicate each other in one test case. Is it possible to do it?  
I could managed it with open a new incognito window but it uses robotframework which doesnt work on headless executing.

---

<div class="post-metadata">

**Author:** ![andrew1](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@andrew1](https://forum.katalon.com/u/andrew1)\
**Post date:** [June 15, 2018, 2:54pm UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/2 "2018-06-15T14:54:39Z")

</div>

You can use the “open browser” 2 times in your code.

---

<div class="post-metadata">

**Author:** ![Magyar\_Zoltan](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Magyar\_Zoltan](https://forum.katalon.com/u/Magyar_Zoltan)\
**Post date:** [July 5, 2018, 1:28pm UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/3 "2018-07-05T13:28:46Z")

</div>

it doesnt work. It closes the browser than open a new one.

---

<div class="post-metadata">

**Author:** ![andrew1](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@andrew1](https://forum.katalon.com/u/andrew1)\
**Post date:** [July 5, 2018, 1:32pm UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/4 "2018-07-05T13:32:38Z")

</div>

> Magyar Zoltán said:
> 
> it doesnt work. It closes the browser than open a new one.

Your code should look like this,

Open browser

Navigate to URL

Check that the “close browser” part is not present.

Open browser

Navigate to URL

---

<div class="post-metadata">

**Author:** ![Magyar\_Zoltan](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Magyar\_Zoltan](https://forum.katalon.com/u/Magyar_Zoltan)\
**Post date:** [July 6, 2018, 8:50am UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/5 "2018-07-06T08:50:54Z")

</div>

there’s no close browser part.  
In the log it says: “A browser is already opened. Closing browser and opening a new one”

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 17, 2021, 12:59am UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/6 "2021-01-17T00:59:07Z")

</div>

> [@How to Test Two Browsers using WebDriver](http://forum.katalon.com/t/how-to-test-two-browsers-using-webdriver/51133):
>
> Hi Russ\_Thomas, I think that @Hariprasad1 was referring to two browsera. Anyway, I have the same problems when I have to switch from one browser to another. Following my script into TestCase: System.setProperty(‘webdriver.chrome.driver’, DriverFactory.getChromeDriverPath()) WebDriver driver1 = new ChromeDriver() WebDriver driver2 = new ChromeDriver() // first browser DriverFactory.changeWebDriver(driver1) WebUI.openBrowser(’’) WebUI.navigateToUrl(‘MY HTTPS A’) //some action // second…

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 17, 2021, 12:59am UTC](https://forum.katalon.com/t/is-it-possible-to-have-two-browsers-with-different-sessions-in-one-test-case/11550/7 "2021-01-17T00:59:20Z")

</div>

Closed on January 17, 2021, 12:59am UTC


