How to open browser as logged in?

Hello!

I’m new to Robot Framework and I just wonder that how can I open browser so, that I am logged in it? The normal “Open Browser http://www.google.com firefox” will open Firefox so that I’m not logged in it.

-Antti

Hi Antti,

What do you mean by:

This can mean several things, e.g.:

  • signed into google with a google account?
  • signed into an internal application using SSO like would happen with IE/Edge?
  • signed into an application using saved credentials?
  • something else?

For some applications you can pass the username/password credentials in the url e.g.:
Open Browser http://user:password@www.mysite.com firefox

If you want to retain saved credentials then you’ll probably want to look into using the ff_profile_dir (see Open Browser documentation)

Hope that’s somewhat helpful,

Dave.

I mean that I’m signed into google and other applications using saved credentials. Just like I log into Windows and open browser (Chrome or Firefox) by clicking it from toolbar. It opens browser so that I’m logged into my Google account, and remembers my saved credentials, etc.

Now when I use that ”Open Browser” command, it opens browser that I’m not logged in to Goolge account, no saved credentials and so on. I don’t even know how could I open such browser window manually :smile:

Hi Antti,

In that case I believe what you need is a stored browser profile, this is something I never used so I’m no expert in this.

I know in SeleniumLibrary you can do this with something like ff_profile_dir in Open Browser

For BrowserLibrary I’m not 100% sure what the equivalent is, but from looking at the documentation I believe what you need is storageState on New Context complimented with Save Storage State (this link provides the documentation on how to use it)

In your case as you are dealing with google apps and that probably means having to deal with the “i’m not a robot” things, so for the “test” that sets up the profile with the stored credentials you will want to let it wait long enough for you to manually intervene for that step, there are several ways you could do that:

  • Just add a really long sleep >2min to give yourself time, and then when you’re done just wait patiently
  • Wait Until Keyword Succeeds with a long retry interval >15sec and 10+ retries to still give yourself time, but not have to wait too long once your done, the keyword that you waiting until passes should check for something on the page after you are signed in
  • Pause Execution from the Dialogs library will pop a dialog when the test reaches that point and pause the test, do the manual steps you need and close the dialogue to continue the test and save the profile.

Looks like you’ll need:

  • 1 test that you run once to create the stored profile
  • you test cases that use the stored profile once created

Hope that helps,

Dave.