While installing Google Chrome, it creates a default profile folder in your local drive that saves info like bookmarks, passwords, user preferences, and some other settings. You can have multiple Chrome profiles, each containing a separate set of user information. Let's say there are two users who are using the same computer, and both want their own Chrome settings then both users can create & access their own Chrome profile whenever they open the Chrome browser.
When Chrome is launched with Selenium WebDriver, certain plug-ins, extensions, bookmarks, etc. are not available. It opens a blank Chrome browser. Sometimes we need these plug-ins, extensions, etc. while executing the selenium test case.
To enable the usage of these different bookmarks, have separate extensions, plug-ins, etc. Chrome's profiles system comes in handy. Multiple profiles can be created on a system, each profile having its own bookmarks, settings, add-ons, browser history, cookies, and other data.
What is the need of creating a custom Chrome profile?
- Many times, we require some special settings in the Chrome profile just to make test execution more reliable. The most common example is an SSL certificate settings or browser plug-ins that handle self-signed certificates. For these kinds of requirements during test execution, we need to create a custom profile that can easily handle this requirement & make test execution more reliable.
- Every time you use different profiles, the SSL certificates you accepted or the plug-ins you installed would be different and that would make the tests behave differently on the machines.
- Always make sure that the profile you have created must be very lightweight that only includes those plug-ins, extensions, and settings that are required in test execution. Whenever selenium starts, a new session is created for Chrome instance that copies the entire profile in some temporary directory and if the profile is big, it makes it slow & unreliable.
Google Chrome allows you to manage profiles while it’s running. To access this feature, go to Google Chrome and navigate to settings after clicking on the vertical ellipsis. In settings, click on the 'Chrome name and pictures' section under the People category.
This will expand this category and you will be able to select a new avatar for your profile and link it with the same google account.
You can verify the profile by navigating to 'chrome://version/'. This will provide the details of the profile that you are using currently as shown in the screenshot below:
Chrome stores its information about the different profiles that have been created till now in the below folder:
- C:\Users\<user>\AppData\Local\Google\Chrome\User Data\<profile>
How to create a new profile in Chrome:
1. To create a new profile, you can click on your current profile and navigate to Manage People as shown below
2. This will take the control to a new popup where you can create a new profile by clicking on the Add person as shown below
3. You can select a new avatar and create the profile by providing a descriptive name for the new profile, so you can remember what it’s for. For example, you might name it “Selenium Test” if it’s for some selenium tests as shown below
Note: To use the profile that you have created above, make sure that all the instances of the chrome browser that are opened using some other profile should be closed before executing the Start Web Browser building block.
To use this profile inside Leapwork, specify the profile path in Start Web Browser Block inside the user profile property. The Browser window that it will launch will be as per the specified profile.
For any clarification, please contact our Priority Support.