Is it possible to use Chrome profiles with Browser?

Is it possible to launch new browser instance with Browser library which would use an existing Chrome profile, as it is in SeleniumLibrary with chromeoption argument --user-data-dir?

Hi Mikko,

I’ve never tried this but from the documentation it looks to be possible:

from the section Browser, Context and Page we have this example which you would use instead of Open Browser:

* Test Cases *
Starting a browser with a page
    New Browser    chromium    headless=false
    New Context    viewport={'width': 1920, 'height': 1080}
    New Page       https://marketsquare.github.io/robotframework-browser/Browser.html
    Get Title      ==    Browser

then when we refer to the documentation for New Browser we find the args option that can be passed to New Browser which tells us that The list of Chromium flags can be found here following that link gives us a page “List of Chromium Command Line Switches” which contains a –profile-directory option.

Combine all that and you should in theory be able to make it work.

Hope that helps,

Dave.

Hi Dave,

and thanks for the tip, but after a quick try I wasn’t able to get this working. Browser instance is still opened in Incognito mode, or maybe I passed the profile-directory argument in incorrect way. But I’ll dig a bit deeper!

Ok, sorry I wasn’t much help then, there are people here who are involved in the development of BrowserLibrary hopefully one of them will chime in and help. As I never tried to use this feature I can only go on what the doco says.

Good luck.

Dave.

Hi

What you want is not possible out of the box, but we could example expose https://playwright.dev/docs/api/class-browsercontext#browsercontextstoragestateoptions which allows using saved information. If you think that would be useful, please raise an issu

Chrome profiles can be utilized all the while which implies that you can have different profiles open simultaneously.

Hi, I used New Browser chromium headless=false args=["-incognito"] to set incognito mode. but, it doesnt work,Could you help?

I usedNew Browser chromium headless=false args=["-incognito"] to set incognito mode. but, it doesnt work,…

hi, anyone able to use chrome profile? I tried and failed.

1 Like

There are a couple of things going on here.

First when you first use New Browser, then Open Browser, it looks like the arguments of the first line are not use in the Open Browser session/window.

looks like this:

New Browser chromium headless=false args=["–disable-features= test"]
Open Browser https://mytestapplication.com/staging

resluting: Open Browser doesn’t use the args of New Browser.

Second thing. @limeiling … how the F. did you start with NEW BROWSER running WITHOUT the incognito modus, because when I use it, it ALWAYS starts WITH an incognito session/mode.

By the way it should work like this then:

New Browser chromium headless=false args=["–profile-directory=Person1"]

or if you leave it out… then it wants you to choose one, which is actually a bug to my opinion in the framework because at that point you’re not able to select anything (no active page)

try
New Browser chromium headless=false args=["–profile-directory]

and then you see what I mean

would be nice to be able to enter a

Click id=Person1

afterwards… actually