Opening Chrome Browser with a predefined custom Chrome Profile which stores session info such as credentials and cookies

com.kazurayam.webdriverfactory4ks.ChromeDriverFactory does NOT create a Chrome Profile for you.

You need to manually create a Chrome profile XXXXXX manually before calling cdFactory.openChromeDriverWithProfile('XXXXXX').

How? — See https://www.bettercloud.com/monitor/the-academy/how-to-create-switch-profiles-in-chrome/

Have you created a Chrome Profile with which you want to open?

1 Like

Some stack overflow posts discusses some possible reasons which may cause this problem. For example,

Exception "unknown error: failed to write prefs file" is thrown when same 
user-data-dir and profile is used by two chrome instances in parallel.

In this case, you should stop ALL Chrome browser, and try again.

1 Like

hi,

please fix the paths in a document & testcases
//import com.kazurayam.ks.thoughtful.ChromeDriverFactory
import com.kazurayam.webdriverfactory4ks.ChromeDriverFactory
//import com.kazurayam.ks.thoughtful.ChromeProfileFinder
import com.kazurayam.webdriverfactory4ks.ChromeProfileFinder

Hi @kazurayam, how were you able to handle this error

Close all of Chrome Browser’s Window on your PC before you execute the test.

Is there no other way for this to be handled? I’m not running my Automation on Virtual Machine or remotely

Vertual Machine? remotely? — I do not understand how these factors concern about “user data directory is already in use” problem.

Since you mentioned that other open browsers should be closed, i figured that in order for me to run this safely without disrupting my other tasks, it would really need me to use some virtual machine so I can isolate my automation runs. Anyways, your code helped me figure out how to bypass Active Directory. Thank you very much for this! :smiley:

The following post may help

1 Like

This was my primary motivation why I researched how to start Chrome Browser with predefined custom Chrome Profile.

To tell you the truth, I was not successful for my issue. I have never succeeded to make Chrome Browser started retaining “already logged in status” of Web applications. I could not find out the detail but Chrome Browser is very well-engineered in terms of “Security”. I could not cheat Chrome at all.

I have got tired trying to cheat Chrome, and I am negative I could achieve it in future.

@kazurayam
Man , you`ve solved one of my worst problems and i thank you so mush <3 .
But there is always the question, can we have the same thing for other browsers , Firefox , Opera,Safari maybe ?

No, I am not willing to. Looking at one browser is heavy enough. No more, thanks.

I have ever worked on Firefox:

but I forgot all about this.

Hello! Any chance to do the same in incognito mode?
Thanks for the aswer.

I don’t understand this. Chrome incognito mode and Chrome Profile — these 2 things seem not relevant at all to me.

1 Like

I’ve set up the profile, did all the steps, however, is it possible for that profile to open a chrome in incognito mode, always?

To be honest, I do not know. All I knew about “Incognito mode” is the following artcile.

https://thepugautomatic.com/2016/02/chrome/#:~:text=You%20can%20open%20an%20"incognito,be%20logged%20out%20of%20everything.

I have never used Chromes Incognito mode. I know nothing about the internal.

This question does not make sense to me.
‘Incognito’ means … to me … being anonymous without any specific profile prepared and recorded.

1 Like

Yes, you are correct. The thing is that the application that I have been testing for a while uses user name and password, so, when I try to log in, I am rejected since, by default chrome does not allow third party cookies… It worked (opening browser in incognito and log in) till last week :frowning: Now I am blocked and trying to find a solution for chrome automatically accepting all cookies while in incognito

Chrome is highly secured software. I do not think we can cheat Chrome. I am negative you can find a way to force Chrome to accept externally prepared cookies.

Rather, I would recommend to you to develop a set of lengthy test-case scripts in Katalon Studio that setup cookies from scratch with zero cookies. It will trace login process with ID/PW, it will call up pages and put info to record in cookies etc. It may take several minutes to run through the setup processing. Once you execute the setup scripts, then you can start functional testings with cookies as you setup.

1 Like

Thanks for the help, appreciate it.