Open Chrome Browser as Different User

Hi Experts,

I need to open the chrome browser as different user, can any one help/guide on how to achieve this ?

Manually if we click on Chrome icon and shift + right click, it gives option to run as different user need to achieve same through Ui Path BOT

image

Any help is appriciated

Thanks,

@AjitDeshpande - you can try to open chrome with below command + different user name
… like below

C:\Users\userXYZ>runas /user:userABC C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"

Hi @GBK ,

Thanks for the reply

Tried with this command it is asking password in CMD window, and even if provided with correct password nothing happnes

Thanks

@AjitDeshpande -oh ok… i used this command to open different app…(not chrome) …

maybe can check any option available in powershell script … scripts are better than struggling to automate with click…

Hello, you can try this:

"$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$Password
Start-Process 'C:\Program Files\Google\Chrome\Application\chrome.exe' -WorkingDirectory 'C:\Program Files\Google\Chrome\Application\' -ArgumentList ($WebPage) -Credential ($Cred)"

But if you open browse as different user, you lost every selectors :frowning:

This one works perfectly for me! The only thing is that you need to either hardcode the credentials or if you have stored them under the credential manager, which I did. It works like a charm… Also, there is no need to specify working directory. So the code snip looks something like this :

#this needs to be run only once for module installation

Install-module -name CredentialManager

#if using a stored credential

$cred = get-storedcredential -target

#if manually passing the information or hard-coding credentials

$Username =

$Password =

$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$Password

Start-Process ‘C:\Program Files\Google\Chrome\Application\chrome.exe’-ArgumentList ($WebPage) -Credential ($Cred)

The only catch in the code is that how you want to call it… whether by using the stored credential or by hard-coding

Found a way.

add activity to open chrome : UiPath.Core.Activities.OpenBrowser

set:
BrowserType = Chrome
Url = any url
UserDataFolderPath = path to user pofile as described below

the user profile will usually be like: “Profile 1” or “Profile 2” in the order you signed in to the profiles in chrome. You can find out the profile by trial and error.

The path to the user profile is generally as follows on windows:
“C:\Users\user\AppData\Local\Google\Chrome\User Data”

an example UserDataFolderPath would look like:
“C:\Users\Guest\AppData\Local\Google\Chrome\User Data\Profile 2”

Hello,

I am having issues with this setting, I tried using “C:\Users\Guest\AppData\Local\Google\Chrome\User Data\Profile 1” in UserDataFolderPath but UiPath studio creates a new chrome profile instead of opening the existing one

any ideas on how to fix this?