Automate two different sites as part of the same test

Hello,

I’m new to Katalon but I’m very impressed so far.

I have a scenario where I need to automate a front end and back end website to check cross-domain XHR is working. I have automated them individually as separate tests and can check against a hardcoded test value, but ideally I need to generate a random value in one site and check it shows in the other and vice versa and then repeat across browsers and platforms for the front end (the back end is Dynamics and can always run as Chrome for this test).

Could I run start a 2nd webdriver in the script?

Thanks.

Hello,
Since you have all tests in place why not use global variable to store random value (or set of them) and then check for values in 2nd part of test?
also you can still use ‘hardcoded’ value as default in definitions so all functionality will remain untouched

I agree this is a valid solution, but I wanted to know if I could script two websites at once. I wrote my own solution using Selenium and Appium (but lacking any sort of UI, hence I am trying Katalon) and being able to mingle two sites at once was quite nice, if technically unnecessary.

An advantage of two sites at once is that I don’t have to login to the 1st site, change the value, login to the 2nd, check the value, change a different value, login to the 1st again and check the 2nd value, etc. I can login to both and do whatever I want without any further overhead, it would be quicker to run the tests, though time is not an issue either way.

there is an discussion about 2 browsers from 1 TC using Katalon openBrowser

1 Like

Thanks, I’ll take a look.

Hi Mark,

it is possible.

System.setProperty("webdriver.chrome.driver", "C:\\test\\chromedriver.exe")WebDriver driver1 = new ChromeDriver()WebDriver driver2 = new ChromeDriver()DriverFactory.changeWebDriver(driver1)// first part of testDriverFactory.changeWebDriver(driver2)// second part of test

You can use all WebUI keywords as usual as well as WebDriver methods. If you want to use other browser, create a different instance of WebDriver (ie. FirefoxDriver).

4 Likes

That is indeed awesome, but I’ve used the global variable route for my POC. I’ll consider this if we proceed with Katalon.

Hi @Marek_Melocik
i was trying to automate 2 different logins for the same website so i need to use 2 different browser instances.
can you please give the detailed steps about how to use different browser instances and also how to switch between those instances within the same testcase.
Thank you.

1 Like