How to keep the browser open during development

Hello, I am am moving over from Selenium to use the RF Browser Library.

An issue I have is that as I develop my script I like to run it in the browser to see what its doing, gauge progress, and then when it errors, or comes to the end of my script have the browser stay open so that I can troubleshoot/plan what comes next.

But with the RF Browser my browser always closes at the end of the test. Is there away to keep the browser open? How do others work round this?

Example .robot file I’m using

*** Settings ***
Library    Browser    auto_closing_level=manual

*** Test Cases ***
Has Title
    New Browser    firefox    headless=false
    New Page
#    It contains Playwright but Im going test for Sausages    
    Get Title    contains    Sausages
#    Browser now closes but I want it to stay open so I can see why Sausages failed

My Environment is:
Windows 2022, RF 6.1.1, node: 18.18.2, Python 3.11, and using Visual Code

Thanks for any help,

When I develop my scripts and want to interact with an open Webbrowser (to try out commands and selectors) I either use

Another option - without any debugging - is using the Open Browser Keyword (instead of New Browser)
and set the argument pause_on_failure to True.

Thanks Many, That gives me something to play with… pause_on_failure is already a great start!

I really like this option mentioned by @Many

Use the VS Code Interactive Console with the Robot Framework Language Server Extension

In release 18 it’s possible define Keep option in library import. This will keep node process and the pages open when test execution ends. But it’s users responsibility to close all processes that are left running.

@aaltat Is this new release mostly an update to work with Playwright version 1.40?

18 is bigger than our normal releases and it has some backwards incompatible items too. It also comes with Playwright 1.40 as you suspected. All changes can be found from release notes

1 Like

Thanks Aaltata,


does the trick nicely during development, saves me having to put Pause Execution at the end of my script, which I inevitably forget :smiley:

1 Like