# Run Chrome with a different user than the one who started Katalon

**URL:** <https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421>\
**Category:** Integrations\
**Tags:** chrome, integrations, katalon-studio\
**Created:** [December 13, 2018, 8:41am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421 "2018-12-13T08:41:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [December 13, 2018, 8:41am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/1 "2018-12-13T08:41:33Z")

</div>

Hello,

Actually, when I run a Test Suite in Katalon, it seems the web browser is started with the same user who started Katalon. In my company, we have to start Katalon with admin rights so Chrome is started with admin rights. But for proxy authentication reasons, the Web access are not the same compare to the normal user doing the test manually in the browser ( for example the Google APIs are not reachable ).

I tried ugly things with Keywords or Listerners starting Chrome with runas or psexec, it’s not working very well.

How can I change the Chrome settings to run it as the legacy user and not the admin user who started Katalon ?

---

<div class="post-metadata">

**Author:** ![Mariusz](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/mariusz/32/386_2.png) [@Mariusz](https://forum.katalon.com/u/Mariusz)\
**Post date:** [December 13, 2018, 10:18am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/2 "2018-12-13T10:18:50Z")

</div>

Try to experiment with user permissions for chromedriver.exe  
Maybe this article will help you [https://www.digitalcitizen.life/take-ownership-and-change-permissions-files-and-folders](https://www.digitalcitizen.life/take-ownership-and-change-permissions-files-and-folders)

Other way, you can write a bat file with following code: **runas /user:Bob “chromedriver2.exe”**  
Convert that file from bat to exe, change name to chromedriver.exe and from now on Katalon probably will use this file to start chromedriver2.exe (original file)

Not sure if this will work, but you can try 😉

---

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [December 13, 2018, 10:35am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/3 "2018-12-13T10:35:04Z")

</div>

Thank you Mariusz for your reply, unfortunately it seems the settings for the chrome driver are not what could solved my problem.

I already test with the runas, but I have to type the password of the legacy user in the batch prompt and unfortunately it’s impossible to do it without a web browser opened. For example this is not working :

WebUI.sendKeys(null, “password”) // type the password  
WebUI.sendKeys(null, Keys.chord(Keys.ENTER)) // valid the command prompt to start Chrome

I tested too the psexec downloaded from here : [https://docs.microsoft.com/en-us/sysinternals/downloads/psexec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec)

And with a command like this : psexec \computername -u domain\user -p password “chrome.exe”

But it’s not very proper and I have now a problem of password management inside the company.

---

<div class="post-metadata">

**Author:** ![Mariusz](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/mariusz/32/386_2.png) [@Mariusz](https://forum.katalon.com/u/Mariusz)\
**Post date:** [December 14, 2018, 6:59am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/4 "2018-12-14T06:59:31Z")

</div>

Or maybe you would run Katalon in a virtual machine?

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [December 14, 2018, 7:06am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/5 "2018-12-14T07:06:17Z")

</div>

why do you need to run katalon with admin rights?  
for me is running just fine as simple user

---

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [February 13, 2019, 10:00am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/6 "2019-02-13T10:00:47Z")

</div>

In my company policies you’re not able to run software until you have a dedicated admin account.

I actually solved my problem by pushing Katalon on the white list of software of my company, it can be started with a normal user. And now chrome is started with the same user and the behaviour is ok.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Rajeev\_Kumar](https://forum.katalon.com/u/Rajeev_Kumar)\
**Post date:** [February 25, 2019, 11:17am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/7 "2019-02-25T11:17:56Z")

</div>

Any update on this?  
I want to run the browser as different user for my testing.

---

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [February 25, 2019, 11:52am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/8 "2019-02-25T11:52:54Z")

</div>

Hi, no update since I created the Topic.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Rajeev\_Kumar](https://forum.katalon.com/u/Rajeev_Kumar)\
**Post date:** [February 25, 2019, 11:56am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/9 "2019-02-25T11:56:25Z")

</div>

Thank you, so how you are doing your testing now.I could find .net impersonation code but not sure how that will work in katalon(groovy) if i do some modification .

---

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [February 25, 2019, 12:12pm UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/10 "2019-02-25T12:12:04Z")

</div>

As a good user of Ranorex I tried the same approach, I tried to translate my C# code into Java / Groovy but I was not able to to something regarding the Policy of my company in term of security.

This is the workaround as described in my previous Post :

> I actually solved my problem by pushing Katalon on the white list of software of my company, it can be started with a normal user. And now chrome is started with the same user and the behaviour is ok.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Rajeev\_Kumar](https://forum.katalon.com/u/Rajeev_Kumar)\
**Post date:** [February 25, 2019, 3:06pm UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/11 "2019-02-25T15:06:27Z")

</div>

Could you please copy the java/groovy code here.Thanks in advance

---

<div class="post-metadata">

**Author:** ![JHE](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JHE](https://forum.katalon.com/u/JHE)\
**Post date:** [March 1, 2019, 8:09am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/12 "2019-03-01T08:09:39Z")

</div>

As said before, my code to launch an external application ( from Katalon ) wasn’t really working due to the security policy of my company. I solved my problem by adding Katalon to the white list of my company and now I can launch it with a normal user then Chrome is started by the same way.

BTW if you’re looking for some Java code allowing you to start a process :

```
import java.io.*;
Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe","param1","param2").start();
```

---

<div class="post-metadata">

**Author:** ![Madhuri](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Madhuri](https://forum.katalon.com/u/Madhuri)\
**Post date:** [May 2, 2019, 8:12am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/13 "2019-05-02T08:12:08Z")

</div>

Hi, Does anyone has any solution to run chrome as different user? If so how can we communicate that driver to user specific profile before opening the browser itself. Please suggest.

---

<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:** [May 2, 2019, 9:57pm UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/14 "2019-05-02T21:57:58Z")

</div>

> [@Madhuri](#):
>
> how can we communicate that driver to user specific profile before opening the browser itself

Have a look at this post:

> [@Open Browser with Custom Profile](http://forum.katalon.com/t/open-browser-with-custom-profile/19268/):
>
> This tutorial is inspired by this question: Katalon Studio automatically prompts a new browser with no cached data for every test execution. However, sometimes you need to have some types of default state, for example, to verify that an action is taken when a user logs in for the first time ever. This test scenario requires that a new browser must be opened with some cached data. This tutorial is aimed to demonstrate how to do this scenario in Katalon Studio. This tutorial will guide you thr…

---

<div class="post-metadata">

**Author:** ![Madhuri](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Madhuri](https://forum.katalon.com/u/Madhuri)\
**Post date:** [May 3, 2019, 1:15pm UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/15 "2019-05-03T13:15:59Z")

</div>

Thanks for giving me reference to look at but still i’m facing some issues. Please have a look at below and correct me if i’m doing anything wrong.

Note: I’m working on Client machine where network access and permissions are very restricted.

Steps followed as per my requirement:

1. I did run as different user on Chrome browser and logged in using profile with username as ‘test01’ and password as ‘xxxxx’
2. It opened a new instance and once i hit the testing url again it opens a alert box to enter the profile credentials so after i enter them i can access the site with that specific profile.
3. Below is the profile path displayed and required admin permission to access the folder ‘test01’
4. Profile path mentioned in chrome://version: “C:\Users\test01\AppData\Local\Google\Chrome\User Data\Default”

Code written to use profile  
// Copy the path to chromedriver.exe  
String pathToChromeDriver = “C:\Automation\Katalon\_Studio\_Windows\_64-5.9.1\configuration\resources\drivers\chromedriver\_win32\chromedriver.exe”

System.setProperty(“webdriver.chrome.driver”, pathToChromeDriver)

//The below profile path is the one that got created when i did run as different user  
String chromeProfilePath = “C:\Users\test01\AppData\Local\Google\Chrome\User Data\”;

//String chromeProfilePath = “C:\Users\myuser\AppData\Local\Google\Chrome\User Data\”; --\>\> I can only access profiles for default user ‘myuser’ folder

ChromeOptions chromeProfile = new ChromeOptions();

chromeProfile.addArguments("–no-sandbox");  
chromeProfile.addArguments("–disable-extensions");  
chromeProfile.addArguments(“start-maximized”);

chromeProfile.addArguments("–disable-popup-blocking");  
chromeProfile.addArguments("–disable-dev-shm-usage")  
chromeProfile.setExperimentalOption(“useAutomationExtension”, false)

chromeProfile.addArguments(“user-data-dir=” + chromeProfilePath);  
// Here you specify the actual profile folder (Profile 2)  
chromeProfile.addArguments(“profile-directory=Default”);

WebDriver driver = new ChromeDriver(chromeProfile);  
driver.get(“[https://xxxxxxx/lightning/page/home](https://xxxxxxx/lightning/page/home)”);  
DriverFactory.changeWebDriver(driver)

Below is the error which i’m facing:  
2019-05-03 17:52:39.341 _[1;31mERROR_[0;39m _[36mc.k.katalon.core.main.TestCaseExecutor -_[0;39m _[31m❌ driver = new org.openqa.selenium.chrome.ChromeDriver(chromeProfile) FAILED._[0;39m  
_[31mReason:_[0;39m  
_[31morg.openqa.selenium.WebDriverException: unknown error: cannot create default profile directory_[0;39m

---

<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:** [May 4, 2019, 3:01am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/16 "2019-05-04T03:01:02Z")

</div>

> [@Madhuri](#):
>
> ```auto
> String chromeProfilePath = “C:\Users\test01\AppData\Local\Google\Chrome\User Data\”;
> //String chromeProfilePath = “C:\Users\myuser\AppData\Local\Google\Chrome\User Data\”; --&gt;&gt; I can only access profiles for default user ‘myuser’ folder
> 
> ```

Sorry, I do not follow you. I do not see what you want to achieve.

Do you use Windows OS user named “test01” not not?

Have you created a Chrome profile named “myuser” or not?

Please distinguish Windows OS user and Chrome Profile. It seems you do not distinguish these 2 different concepts.

---

<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:** [May 4, 2019, 3:10am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/17 "2019-05-04T03:10:00Z")

</div>

If you have created Chrome profile “myuser” and logged into Chome with it, then you want to retrieve `chrome://version` page. The page will show you the path of the Profile. That would look something like the following screenshot

 ![profile_path](https://europe1.discourse-cdn.com/katalon/original/2X/a/a0960cf9def772c09b1dcdc0e32925149294a5dd.png)  
The Profile Path would be something like

```auto
D:\Users\test01\AppData\Local\Google\Chrome\User Data\Profile N

```

where N would be 1, 2, 3, 4,… it is allocated by Chrome when “myuser” profile is created.

You need to find which “Profile N” is allocated for the Profile “myuser” by Chrome. — see the following post, where I explained how I solved the problem.

> [@Open Browser with Custom Profile](http://forum.katalon.com/t/open-browser-with-custom-profile/19268/13):
>
> I could successfully developed a set of Groovy classes named webdriverfactory4ks. This library enables me to launch Groogle Chrome browser specifying a Custom Profile name. You can use it as follows: import com.kazurayam.ksbackyard.webdriver.ChromeDriverFactory ... @Test void test\_openChromeDriver() { ChromeDriverFactory cdFactory = new ChromeDriverFactory() WebDriver driver = cdFactory.openChromeDriverWithProfile('Katalon') // Katalon is a Profile name assertThat(driver, is(notNullV…

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [May 4, 2019, 4:31am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/18 "2019-05-04T04:31:47Z")

</div>

@kazurayam  
i think is opposite, his win user is ‘myuser’ and ‘test01’ the profile created 🙂 … but i can be wrong, it is not very clear where the OP is blocked  
@Madhuri on short, the new chrome profile created should be found under the windows user path and have a name like ‘Profile N’, don’t use the Default one.

---

<div class="post-metadata">

**Author:** ![Madhuri](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Madhuri](https://forum.katalon.com/u/Madhuri)\
**Post date:** [May 5, 2019, 10:41am UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/19 "2019-05-05T10:41:58Z")

</div>

Hi @kazurayam and @Ibus, sry for the confusion  
Yes my window user is ‘myuser’ so if I create any profile its been under ‘myuser’ with ‘Profile N’. But I’m unable to use this for my scenario as its little different.

Scenario 1: Client has given access for QA environment for my window user i.e., ‘myuser’ but can test only few scenarios. Its just a login with SSO option hence its logs in automatically without any user credentials.

Scenario 2: Client has provided few user profiles which we should do run as different user in chrome and then access the QA for testing other scenarios

Here the problem is even if I create profiles and hit the QA url the login with different profile doesn’t work, it just has login with SSO button so it automatically logs me as ‘myuser’

I can login with different profile only when I do run as different user in chrome and detailed steps followed is mentioned in my previous post

When I run as different user with username ‘test01’ and observed the profile path as below:  
“C:\Users\test01\AppData\Local\Google\Chrome\User Data\Default”  
I saw the folder test01 created as per above path but i cannot access the folder items

Please suggest how to achieve the second scenario in this case.

Thanks!!

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [May 5, 2019, 12:59pm UTC](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421/21 "2019-05-05T12:59:31Z")

</div>

mhm … for me looks like the ‘test01’ is also a windows user provided.  
i have a strong feeling that your client make your life complicated because he feels that he must be in control.  
for such cross user/profile/browser automated testing, in order to be relevant (aka repeatable results), imho browserstack is the right solution, not a single reused phisical machine  
relevant testing implies certain abstractization. at this moment you are enforced to test using ‘another winuser credentials’ but without permissions on that account. this is a no go, virtualization to the rescue

[Next page](https://forum.katalon.com/t/run-chrome-with-a-different-user-than-the-one-who-started-katalon/15421.md?page=2)
