Actually I am trying to do a PoC in which I have the chrome open and I want to katalon to execute the steps in the new tab of already opened window . Is it possible ?? I googled alot but no solution seems to be working .
Are you saying that youâre opening a browser window manually, then you want Katalon to execute in this browser instance? If so, I donât believe that is possible, because the instance will not have a chromedriver associated with it.
You can always have Katalon open a browser, but not navigate anywhere:
WebUI.openBrowser()
You would then be able to mess around with that window manually, then run a script against it by right-clicking on a line of code in your script, then clicking Run from here > your browser instance.
In any case, I believe you will need a Katalon-generated browser instance.
well then its problematic âŚ
From what I can find, a feature like this was requested, but ultimately abandoned by the Selenium team:
Iâve read a couple articles claiming that itâs possible, like this one for example:
But it looks like quite a hack to finagle with.
thank you so much for sparing your time for this. I will this hack ⌠i have one more urgent doubt if u cud help me with . I wanna handle this alert
In the same fashion as my response to your other question:
try adding the following property:
Sure . Iwill try and post the result⌠Thanks
Hi Brandon, I tried this setting for the below issue but its not working , I have made exact setting suggested by you , but it doesnât seems to work.
My settingsâŚ
I actually spent a good portion of my day on this as well. The desired capability I recommended has worked for me in the past, but fails on the most current version of ChromeâŚ
This is actually quite a rabbit hole, but here we go:
There was a change made in 2013 as to how Chrome handles multiple download requests for a single session on a website. My guess is that it was for security reasons. I can imagine that if a user wasnât notified of multiple files being downloaded from a single click, a dubious character could sneak some pretty nasty stuff in there.
That popup is the result. The problem is, they keep changing how the âAllowâ or âBlockâ setting is stored every couple of years, which makes pinning down the right Desired Capability a moving target. The solution I proposed used to work:
profile.default_content_settings.popups = 0
but it looks like itâs changed once again. Iâve tried a couple of other ones, but the most recent solution I could find didnât work.
The only other workaround (that I can confirm works) is to refresh the browser right after the first file is downloaded using:
WebUI.refresh()
Beyond that, hopefully weâll hear something from the Chrome devs about this at some point
For anyone else who finds this, I use the following Keyword setup:
/**
* Connect to a chrome client with --remote-debugging-port enabled
*
* @param port the chrome client's remote debugging port
* @return a WebDriver connected to the chrome client
*/
@Keyword
public static WebDriver connectToRunningClient(int port = 9222) {
// Get path to Katalon's chromedriver
String chromeDriverPath = DriverFactory.getChromeDriverPath()
// Set up the chromedriver path
System.setProperty("webdriver.chrome.driver", chromeDriverPath)
// Set the host and port of the running chrome instance
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("debuggerAddress", "localhost:$port");
// Create the chromedriver
WebDriver driver = new ChromeDriver(options);
// Change Katalon's default chromedriver to this one
DriverFactory.changeWebDriver(driver)
return driver
}
Setup
1. Launch chrome in remote debugging mode
Youâll want to launch chrome using the --remote-debugging-port
flag, e.g.:
$ /path/to/chrome --remote-debugging-port=9222
2. Call the keyword at the beginning of your script
CustomKeywords.'com.your.package.connectToRunningClient'()
// Verify that we successfully connected by printing the title
title = WebUI.getWindowTitle()
KeywordUtil.logInfo("Title: $title")
Et voila! You can now run scripts that connect to your launched browser. I like to use this for larger Test Cases where I donât want to have to run through the whole thing to test step 285 Iâll create some temporary test case, connect it to a launched chrome session thatâs already at step 284, and then test the new step. Once Iâve verified itâs working, Iâll add it to the the actual test case