Auto_closing_level in Browser Library Import

Hi, according to documentation:

“All browsers are automatically closed, always and regardless of the automatic closing level at the end of the test execution. This will also close all remaining pages and contexts.”

but also

“Automatic closing can be configured or switched off with the auto_closing_level library import parameter.”

Now I have set this parameter to MANUAL and all browsers and windows are been shut down at the end, this is something I don’t want to happen. How can I set the browser to not close at the end? Can this function be switched of or does it happen regardless of settings?

Currently that is not possible, because we close everything at the end of the test execution. But adding something like that could be possible, could you tell why you want to do so? Also raising an issue in the Issues · MarketSquare/robotframework-browser · GitHub could be useful.

Well it’s got more to do with how I build tests.
First I make some code, then I run the test and I use the open test browser to get elements for the next steps. The thing is, that with the application I’m currently testing, I have to create these instances of events and it becomes a bit of a nuisance if I have to use different browser to follow the steps of test browser in order to get where the test browser already was, just so I could continue from there.



If I understood you right, it is mostly about creating/writing test, right?

So you define a test to a specific point and check it until this point it works, then you define the next steps.
And you do NOT want to navigate there manually but use the current stage to proceed.

To support exactly this, I developed the “Robot Framework Debugger”.
It is a small GUI that starts on certain situations and pauses the test and let you try more keywords.
It also logs all successful keyword calls, so that you can just copy them before closing the debugger.

pip install robotframework-debugger

An alternative is DebugLibrary. It is basically the same, but in the console.

Or with Browser library you can also just put the Dialogs library Pause Execution Keyword as last keyword call.


The readme is little bit thin, with the information and instructions available I have not been able to make that debugger library work. Kinda shame, it sounds like exactly what I have been looking for


You have to start Robot Framework with the “Debugger” attached as Listener.
robot --listener Debugger myrobotsuite.robot

Then the Debugger will open if a Keyword Fails, or if you call a Keyword Debug

So make something like this:

*** Settings ***
Library    Browser

*** Test Cases ***
    New Browser    headless=False
    New Context
    New Page
    Debug    Hello World
1 Like

Yes, that debug keyword was the golden ticket. Must have missed it on your git.
However, for some reason the gui crashes about 90% of the time rendering it mostly unusable. So far I have not been able to get it work without crashing, but other than that it seem pretty good.

Sorry to hear that… :confused:

Any exceptions?

No, it just becomes unresponsive and freezes.


So I updated everything and now it works 90% of the time, and that’s good enough for me. The Debugger is a good tool and even thou it doesn’t work 100% of the time, it works well enough to help me develop tests faster.

Do you know if there are libraries that work the other way? Like you click a button or input a value in the browser and the library turns these simple actions into code with the elements locator? Would something like that even be possible?