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.
Could you please copy the java/groovy code here.Thanks in advance
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.
Have a look at this post:
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)
WebDriver driver = new ChromeDriver(chromeProfile);
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
[31morg.openqa.selenium.WebDriverException: unknown error: cannot create default profile directory[0;39m
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.
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.
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:
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
this is a common problem created by dumbass product owners, they cannot understand that the tester must have full controll of the testing environment in order to produce accurate test results
othwrwise,as a last resort,we can do ‘extensive blind testing’. and god have mercy on them sorting the bug reports
@Madhuri i had once a similar issue. i just made a story defect, sort of ‘feature failed testing due to no relevant access for testing team to the environment’.
2nd day i was granted with admin rights on whatever i need
Yes. They do give me access for QA for user ‘test01’ with Default Profile but I dont have permission to check the items in profile path.
Steps followed as per my requirement:
- I have to run as different user on Chrome browser and logged in using profile with username as ‘test01’ and password as ‘xxxxx’
- It opened a new chrome 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 user profile.
I need some way to automate the above procedure to execute my scripts in Katalon otherwise the scripts will be of no use
So you want to somehow automate entering the credential into the alert box. The alert box is possiblly Chrome native, nothing to do with HTML.
I have never seen it. Really I do not have idea what. But I guess, it is out of the scope of Katalon/Selenium UI automation capability which is all about HTML DOM operation.
I remember, several months ago, @Russ_Thomas mentioned about a tool (sorry I forgot the name) which enables you to automate any UI operation on Windows, and possible useful for Madhuri. I would invite him to join us here.
Any tool which supports windows UI operation is fine but are those scripts can be integrated with Katalon.
I have done all the scripting in Katalon so pls suggest a way to integrate with the Window operation and then execute the groovy scripts using the same browser session
there are some topics on this forum on how to use winium with katalon
Russ once said he uses AutoHotKey a lot
I don’t know AutoHotKey at all.
Do you want to execute AutoHotKey as a part of Katalon Test Case?
Once I posted a Test Case example which executes Windows dir command.
You can execute any commands by this method. Possible you can execute AutoHotKey script as well.
Ok. Will give it a try though i’m also very new to this tool.