Katalon does not recognize own opened Chrome as ACTIVE BROWSER

My scripts in Katalon Studio are running excellent under Chrome as only browser, cannot run as easily with neither IE or Firefox.

I have an odd problem: i ran a script in Katalon and it ends, browser remains open. Now I want to Spy Web or Record from that point on but Katalon does not recognize the browser instance (which i started and in which it executed the script) as ACTIVE BROWSER.

By contrast, if there is a manually opened Chrome or if I open one then Katalon will gladly recognize it as ACTIVE BROWSER and Spy Web or Record.

I have noticed that when I open several Chromes manually the icons gather one behind the other in the system tray all behind the Chrome icon.

https://s18.postimg.org/v530e0d2h/Chrome_manually_opened.jpg

On the other hand a Chrome opened by Katalon Studio is placed at the right end of the system tray not behind the Chrome icon.

https://s18.postimg.org/bzzr49du1/Chrome_opened_by_Katalon.jpg

Is this normal?

Anyone else has seen the same?

Have Liam B or Vinh Nguyen seen this question?

I am puzzled I am the only one with this problem.

Fresh installed and reinstalled Chrome. Run likes a dream with Katalon Studio and alone.

I can Record/Spy Web perfectly if I start my flow from the beginning (websites page 1) launching Chrome manually and stopping at a certain pont. From there on can Katalon continue Record or Spy Web.

So Katalon Studio recognizes fine manually launched Chrome instances as ACTIVE BROWSER.

But if I run the same steps with a Katalon script and stop (without error) at the same point and want to continue Record or Spy Web then Katalon will not recognize that as ACTIVE BROWSER.

Can somebody help?

Claudinho said:

My scripts in Katalon Studio are running excellent under Chrome as only browser, cannot run as easily with neither IE or Firefox.

I have an odd problem: i ran a script in Katalon and it ends, browser remains open. Now I want to Spy Web or Record from that point on but Katalon does not recognize the browser instance (which i started and in which it executed the script) as ACTIVE BROWSER.

By contrast, if there is a manually opened Chrome or if I open one then Katalon will gladly recognize it as ACTIVE BROWSER and Spy Web or Record.

I have noticed that when I open several Chromes manually the icons gather one behind the other in the system tray all behind the Chrome icon.

https://s18.postimg.org/v530e0d2h/Chrome\_manually\_opened.jpg

On the other hand a Chrome opened by Katalon Studio is placed at the right end of the system tray not behind the Chrome icon.

https://s18.postimg.org/bzzr49du1/Chrome\_opened\_by_Katalon.jpg

Is this normal?

Anyone else has seen the same?

Hi there,

First of all I would like to clarify that if you open your browser directly using Katalonm scripts, then it will NOT have an ability to have Katalon add-on installed there. Spy/Record on active Chrome browser requires this add-on: https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid, however this add-on can’t be installed from ‘Open Browser’ step because extensions are disabled.

If you really need Spy/Record on *that* browser, you have to do below steps:
1. Download Katalon add-on: Paste above link into this page to download its crx file): https://chrome-extension-downloader.com/

2. Replace ‘Open Browser’ within your test cases with these lines:

//Set chromedriver path
System.setProperty("webdriver.chrome.driver", "C:\\5.3\\Katalon_Studio_Windows_64-5.3.0\\configuration\\resources\\drivers\\chromedriver_win32\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
//Set Katalon addon extension
options.addExtensions(new File("C:\\Katalon.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
DriverFactory.changeWebDriver(driver)

With this approach then you will be able to Spy/Record on Active opened browser from ‘Open Browser’ step. :slight_smile:

Hello Vinh,

The “Spy Web” work-around you suggested is not working for me…

As per your instructions I did the following:

  1. I downloaded “Katalon-Recorder-(Selenium-IDE-for-Chrome)_v3.1.2.crx” &
    updated my path

  2. I updated the “chromedriver.exe” path

See attached SpyWebTestCase.txt file

Result: When I try to run the case I am seeing errors

See attached SpyWebError.txt file

Can you tell me / point out where I am going wrong?

Thanks,

Dave

SpyWebTestCase.txt

SpyWebError.txt

2 Likes

Ops sorry you need to have necessary libraries. You just need to press ‘Ctrl + Shift + O’ to automatically import your libraries

The overall code should be like this:

import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.webui.driver.DriverFactory
System.setProperty("webdriver.chrome.driver", "C:\\5.3\\Katalon_Studio_Windows_64-5.3.0\\configuration\\resources\\drivers\\chromedriver_win32\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
//Set Katalon addon extension
options.addExtensions(new File("C:\\Katalon.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
DriverFactory.changeWebDriver(driver)
1 Like

Thanks Vinh!
This is now working for me ; -)

1 Like

Just curious, I am on a Mac, what is new file Katalon.crx and what does it do?

It’s the extension for the katalon-recorder-selenium
1st Open: https://chrome-extension-downloader.com/ << Chrome Extension Download page
2nd paste https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid into the “Download extension” field
Click the “Download extension” button
Configure as above…

Dave Evers said:

It’s the extension for the katalon-recorder-selenium
1st Open: https://chrome-extension-downloader.com/ << Chrome Extension Download page
2nd paste https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid into the “Download extension” field
Click the “Download extension” button
Configure as above…

Is this download required every time we try pickup a session and record from that point in time? On the surface this seems like a lot of extra work. We are trying to get the recordings for our testing team to be easy, simple an effective. These steps are not gonna fly and any automation tool should be able to play a script, then allow the user to record from that point in time without jumping through hoops. Sorry for the rant, but this seems so obvious on how it should operate.

For example, in Photoshop, I can create an action, record the action, play it back and then even record from that point. A web browser’s automation should be able to operate the same way.

Currently out testing team and I are manually getting to a point in time on our site and then we start the recording. I will try the steps above and see how much work it is on our Macs, but wow, I am a little taken back that this is not smoother than it is.

Hi Todd,
This is a one-time installation that you point to once you configure the system. I store the files on a network drive so that others can point to it. But I agree it is a bit on the kludgy side. I would recommend asking Katalon for a feature update so that all of us could benefit from it. The old Selenium IDE tool did allow for this, maybe they could base it on that?

1 Like

Ok thanks. I will give this a whirl. We’ll be using GIT, so that should share the ext. I will try contacting Katalon as well. I agree that this would be good to have native and benefit all.

Is there a way to have Katalon Studio put the above code inside automatically when created a new test case? I guess the other way would be to have an example test case already setup and then duplicate it. I may have answered my own question there.

You can get a copy of my Spy Web example here…

1 Open https://github.com/Tigger99/ReadPDF-Documents

2 Click on “ReadPDF documents.rar”

3 Click “Download” & save to the local system

4 Right click on the file & select “Extract Here”

5 Open the “ReadPDF documents” folder from Katalon
6. Check out the test cases …
You will need to edit the paths for the ‘Spy Web Work Around’ test case

I am running into an issue now after upgraded to 5.4.0, test cases are terminating after each test case. Will try this workaround on the previous version. Hope I can still locate it.

haven’t been able to get this to work. here is are my settings for a new test case:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.webui.driver.DriverFactory
System.setProperty('webdriver.chrome.driver',"/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/drivers/chromedriver_mac/chromedriver");
ChromeOptions options = new ChromeOptions();
//Set Katalon addon extension
options.addExtensions(new File("/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/extensions/Chrome/Recorder Packed/Recorder.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
DriverFactory.changeWebDriver(driver)

Dave Evers said:

You can get a copy of my Spy Web example here…

1 Open https://github.com/Tigger99/ReadPDF-Documents

2 Click on “ReadPDF documents.rar”

3 Click “Download” & save to the local system

4 Right click on the file & select “Extract Here”

5 Open the “ReadPDF documents” folder from Katalon
6. Check out the test cases …
You will need to edit the paths for the ‘Spy Web Work Around’ test case

I am not sure what the problem is, but I download 3 Unrar tools and it will not extract on my Mac. I’ll try it on my Windows VM.

I was able to get this to work with the Katalon Recorder downloaded through Chrome Web Store website and not the Recorder.crx that comes with Katalon Studio. Sorry for the confusion. It seemed the same recorder that ships with Katalon Studio could be used but I guess not.

Is there a way to tell the Katalon Recorder when continuing a script not to go to Katalon’s website when it starts up?

I was able to resolve me last issue. thanks.

Great!

Vinh Nguyen said:

The overall code should be like this:

import org.openqa.selenium.chrome.ChromeDriver

import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.webui.driver.DriverFactory
System.setProperty(“webdriver.chrome.driver”, “C:\5.3\Katalon_Studio_Windows_64-5.3.0\configuration\resources\drivers\chromedriver_win32\chromedriver.exe”);
ChromeOptions options = new ChromeOptions();
//Set Katalon addon extension
options.addExtensions(new File(“C:\Katalon.crx”));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
DriverFactory.changeWebDriver(driver)


  

Here is my adapted approach to supporting Mac and PC in the same script. It auto detects Mac OS X or Windows 10. It also has a variable that allows to turn off the recorder / chrome driver to use it as a player or playback to a remove service such as Browserstack:

//Katalon Recorder Starts here
import org.openqa.selenium.Keys as Keys
import org.openqa.selenium.chrome.ChromeDriver as ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions as ChromeOptions
import org.openqa.selenium.remote.DesiredCapabilities as DesiredCapabilities
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
//Autodetect the OS
String detect_platform = System.properties['os.name']
//mac = Mac OS X
//pc = Windows 10
if (use_recorder == true ) {
//Start Load Katalon Recorder
// First check is Windows 10
if (detect_platform == 'Windows 10') {
System.setProperty('webdriver.chrome.driver', driver_pc)
ChromeOptions options = new ChromeOptions()
options.addExtensions(new File(recorder_pc))
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability(ChromeOptions.CAPABILITY, options)
ChromeDriver driver = new ChromeDriver(capabilities)
DriverFactory.changeWebDriver(driver)
// Then it is probably Mac
} else {
System.setProperty('webdriver.chrome.driver', driver_mac)
ChromeOptions options = new ChromeOptions()
options.addExtensions(new File(recorder_mac))
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability(ChromeOptions.CAPABILITY, options)
ChromeDriver driver = new ChromeDriver(capabilities)
DriverFactory.changeWebDriver(driver)
}
//End Load Katalon Recorder
} else {
WebUI.openBrowser('')
}

Vavriables.png