# Unable to test with a newly created firefox profile

**URL:** <https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [March 30, 2021, 4:59pm UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426 "2021-03-30T16:59:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziyaad.ellahee](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ziyaad.ellahee/32/16103_2.png) [@ziyaad.ellahee](https://forum.katalon.com/u/ziyaad.ellahee)\
**Post date:** [March 30, 2021, 4:59pm UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/1 "2021-03-30T16:59:25Z")

</div>

Hi, i am currently exploring newly created profile in firefox.

 ![aboutProfiles](https://europe1.discourse-cdn.com/katalon/original/3X/6/a/6a4a6944bce442735773899b1eaf881ae07b25af.png)

The issue i am facing is that using the Custom Desired Capabilities, i wanted to execute some test scripts with the newly created firefox profile as named in screenshot, Chris\_Hemsworth.

How can i do that?

I did tried something on my own and below is the code but not working:

`{"FIREFOX_DRIVER":{"moz:firefoxOptions":{"args":["--profile\-p -no-remote ChrisHemsworth"]}}}`

Here is a piece of log of error obtained:

```
2021-03-30 20:37:01.360 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2021-03-30 20:37:01.376 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/New Test Case
2021-03-30 20:37:03.687 DEBUG testcase.New Test Case - 1: open_browser.open_browser.openBrowser()
2021-03-30 20:37:04.243 INFO c.k.k.core.webui.driver.DriverFactory - Starting 'Firefox' driver
Mar 30, 2021 8:37:04 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
2021-03-30 20:37:04.418 INFO c.k.k.c.w.util.WebDriverPropertyUtil - User set preference: ['moz:firefoxOptions', '{args=[--profile=-p -no-remote ChrisHemsworth]}']
2021-03-30 20:37:04.419 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 milliseconds
1617122227342	geckodriver	INFO	Listening on 127.0.0.1:12051
1617122228354	mozrunner::runner	INFO	Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--profile=-p -no-remote ChrisHemsworth" "-foreground" "-no-remote"
2021-03-30 20:38:09.652 ERROR c.k.k.core.keyword.internal.KeywordMain - ❌ Unable to open browser (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to open browser
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:63)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
	at open_browser.open_browser.openBrowser(open_browser.groovy:13)
	at open_browser.open_browser.invokeMethod(open_browser.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at New Test Case.run(New Test Case:21)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1617122216102.run(TempTestCase1617122216102.groovy:25)
Caused by: org.openqa.selenium.TimeoutException: No connection could be made because the target machine actively refused it. (os error 10061)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MAEGL63P3', ip: '10.150.0.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: CGeckoDriver
remote stacktrace: 
	at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
	at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CFirefoxDriver.execute(CFirefoxDriver.java:27)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
	at com.kms.katalon.selenium.driver.CFirefoxDriver.<init>(CFirefoxDriver.java:21)
	at com.kms.katalon.core.webui.driver.firefox.CGeckoDriver.<init>(CGeckoDriver.java:12)
	at com.kms.katalon.core.webui.driver.firefox.CGeckoDriver.from(CGeckoDriver.java:17)
	at com.kms.katalon.core.webui.driver.DriverFactory.createNewFirefoxDriver(DriverFactory.java:678)
	at com.kms.katalon.core.webui.driver.DriverFactory.startNewBrowser(DriverFactory.java:349)
	at com.kms.katalon.core.webui.driver.DriverFactory.openWebDriver(DriverFactory.java:245)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:63)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
	at open_browser.open_browser.openBrowser(open_browser.groovy:13)
	at open_browser.open_browser.invokeMethod(open_browser.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Script1617106143643.run(Script1617106143643.groovy:21)
	... 10 more
)

```

Awaiting for a solution guys. Thank you in advance.

---

<div class="post-metadata">

**Author:** ![ziyaad.ellahee](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ziyaad.ellahee/32/16103_2.png) [@ziyaad.ellahee](https://forum.katalon.com/u/ziyaad.ellahee)\
**Post date:** [March 31, 2021, 12:50pm UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/2 "2021-03-31T12:50:25Z")

</div>

@kazurayam, Can you please advise?

---

<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:** [April 1, 2021, 2:48am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/3 "2021-04-01T02:48:31Z")

</div>

I do not know the way you mentioned above.

I made the following code and it worked.

```auto
import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile
import org.openqa.selenium.firefox.ProfilesIni

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

def WebDriver startFirefoxWithProfile(String profileName) {
		FirefoxProfile fp = new ProfilesIni().getProfile(profileName)
		FirefoxOptions options = new FirefoxOptions().setProfile(fp)
		// note: You HAVE TO choose Firefox in Katalon Studio GUI
		String geckoDriverPath = DriverFactory.getGeckoDriverPath()
		println geckoDriverPath
		System.setProperty('webdriver.gecko.driver', geckoDriverPath)
		WebDriver driver = new FirefoxDriver(options)
		assert driver != null
		return driver
}

String profile = 'kazurayam'
WebDriver firefoxDriver = startFirefoxWithProfile(profile)
DriverFactory.changeWebDriver(firefoxDriver)
WebUI.navigateToUrl("https://www.youtube.com/")

```

---

<div class="post-metadata">

**Author:** ![ziyaad.ellahee](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ziyaad.ellahee/32/16103_2.png) [@ziyaad.ellahee](https://forum.katalon.com/u/ziyaad.ellahee)\
**Post date:** [April 1, 2021, 3:38am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/4 "2021-04-01T03:38:39Z")

</div>

I am referring to configuration that we can made as shown in screenshot below:

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/4/2/42d184df7ff95233d0e37338591da0e61ab6b26a.png)

Is there any means which we can configured here to launch execution with a specific firefox profile?

---

<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:** [April 1, 2021, 3:57am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/5 "2021-04-01T03:57:51Z")

</div>

Sorry, I have no experience about it.

---

<div class="post-metadata">

**Author:** ![ziyaad.ellahee](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ziyaad.ellahee/32/16103_2.png) [@ziyaad.ellahee](https://forum.katalon.com/u/ziyaad.ellahee)\
**Post date:** [April 1, 2021, 4:48am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/6 "2021-04-01T04:48:25Z")

</div>

Nevermind…i have tried another way and i’ll explain.

I have created a global variable in the default profile, G\_FFProfile = Chris Hemsworth and i have created a custom keyword :

```
 package firefox_profile
import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxProfile
import org.openqa.selenium.firefox.ProfilesIni
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.driver.WebUIDriverType
import internal.GlobalVariable as GlobalVariable

class startBrowserWithProfile {
	/**
	 * start specific firefox browser
	 */
	@keyword
	def void startBrowser() {

		WebUIDriverType executedBrowser = DriverFactory.getExecutedBrowser()
		switch(executedBrowser) {
			case WebUIDriverType.FIREFOX_DRIVER:
				ProfilesIni profile = new ProfilesIni()
				FirefoxProfile FF = profile.getProfile(GlobalVariable.G_FFProfile)
				FirefoxOptions options = new FirefoxOptions().setProfile(FF)
				System.setProperty('webdriver.gecko.driver', DriverFactory.getGeckoDriverPath())
				WebDriver driver = new FirefoxDriver(options)
				DriverFactory.changeWebDriver(driver)
				break
		}
	}
}

```

However, when i save the custom keyword, i got 2 errors as shown below:

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/6/d/6de42c4cf5215d7c36ac496c119cef13faf2f34f.png)

Do you have any ideas? I tried also the Ctrl+Shift + O to import but still having the errors.

---

<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:** [April 1, 2021, 5:27am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/7 "2021-04-01T05:27:47Z")

</div>

1. `@keyword` -\> `@Keyword`
2. import statement is required

```auto
package my

import com.kms.katalon.core.annotation.Keyword

public class Sample {
	
	@Keyword
	static void greet(String name) {
		println "Hello, ${name}"
	}
}

```

---

<div class="post-metadata">

**Author:** ![ziyaad.ellahee](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ziyaad.ellahee/32/16103_2.png) [@ziyaad.ellahee](https://forum.katalon.com/u/ziyaad.ellahee)\
**Post date:** [April 1, 2021, 6:58am UTC](https://forum.katalon.com/t/unable-to-test-with-a-newly-created-firefox-profile/53426/8 "2021-04-01T06:58:23Z")

</div>

I want to share the solution too:

1. In Katalon Studio, create a global variable in the default profile ( G\_FFProfile = Chris Hemsworth).

2. Then create a custom keyword :

In your script, call the custom keyword instead of the “open browser”

example:

> CustomKeywords.‘firefox\_profile.startBrowserWithProfile.startBrowser’()

@kazurayam Thank you 🙂
