MarketSquare / MarketSquare/robotframework-browser

When a keyword fails and presenter_mode is enabled the browser is not closed

Open
#3,644 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority: critical
Dominant language
Python
Stars
655
Forks
147
Avg merge
5h 27m
Merged PRs (30d)
59

Description

**Describe the bug**

When a keyword fails and presenter_mode is enabled the browser is not closed when the test finishes. The reason is that the keyword Record Selector [is called](https://github.com/MarketSquare/robotframework-browser/blob/db1f59409061245318674486b227795f99488cbf/Browser/base/librarycomponent.py#L340) when a keyword fails and presenter_mode is enabled.

**To Reproduce**

```robotframework
*** Settings ***
Library Browser enable_presenter_mode=True

*** Test Cases ***
Test
New Browser chromium headless=False
New Page https://www.google.com
Click "Yahoo"
```

**Expected behavior**
Browser library should honor the setting auto_closing_level and presenter_mode should behave according to the documentation: the tests run slower and each element acted upon is highlighted.

**Desktop (please complete the following information):**
- OS: Windows 10
- Browser: Chromium installed by `rfbrowser init chromium`
- Version: 18.5.1

**Additional context**
If a user wants to execute Record Selector when a keyword fails, there are several options (which could be mentioned in the documentation): write a Listener, connect to a running Chromium-based browser that was started with --remote-debugging-port, use try-except. This error-handling should not be forced upon all users. presenter_mode is only meant to help the users see what Playwright does.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Browser/base/librarycomponent.py around line 340, where Record Selector is called after a keyword fails, and reproduce the example with presenter_mode enabled. Trace how auto_closing_level and browser cleanup interact with that failure path. Done means the browser closes according to auto_closing_level while presenter_mode still only slows tests and highlights acted-on elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.