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 ?
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)
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
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.
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 .
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.
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();
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.
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:
I did run as different user on Chrome browser and logged in using profile with username as âtest01â and password as âxxxxxâ
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.
Below is the profile path displayed and required admin permission to access the folder âtest01â
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â
//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(â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â);
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
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
The Profile Path would be something like
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.
@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.
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.
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