How to handle the two different browsers..?

Hi Team,
Example: 1. open chrome browser and access the file
2. open firefox browser and try to access the same file here
3. verify the alert msg and access the same file in firefox
4. switch to chrome and verify the alert msg

Please post your solutions to help us

Try doing a search within the Katalon Forum for multiple browsers…This is what I found: Handling Multiple Browser Windows

@Dave_Evers I think this will only help with multiple tabs in the same browser. Here, I think we need to handle two separate browsers of different types completely.

I think you’ll need to create two separate driver instances, then hand them off to Katalon when you need them:

// Open a new Chrome browser. You'll need to provide the path to your chromedriver.exe file on your machine:
System.setProperty("webdriver.chrome.driver", "C:/test/chromedriver.exe");
WebDriver chromeDriver = new ChromeDriver();
// Tell Katalon to use your Chrome driver:
DriverFactory.changeWebDriver(chromeDriver);

// do some work...

// Open a new Firefox browser. You'll need to provide the path to your geckodriver.exe file on your machine:
System.setProperty("webdriver.gecko.driver", "C:/test/geckodriver.exe");
WebDriver firefoxDriver = new FirefoxDriver();
// Tell Katalon to use your Firefox driver:
DriverFactory.changeWebDriver(firefoxDriver);

// do some work...

Here’s a page with some additional details:

https://docs.katalon.com/katalon-studio/docs/using_selenium_webdriver_katalon_studio.html#how-katalon-studio-uses-selenium-webdriver

Thanks @Brandon_Hein excellent point!
I was also hinting that searching the forum can be a good way to find resources too.

1 Like

The following post shows what I have ever done:

It opens 2 browser windows simultaneously. In one window, normal Chrome. In another window, Chrome in Incognito mode. A Test Case communicates with one browser, switch to another, and switch back again.

It is just a twist opening FireFox or other browser types. You can open 3 or more browses if you like.

1 Like