Browser exits automatically

Hello,

I want to try to create a custom library for opening a new browser in a python code:

   def new_portal():
        browser.new_browser(SupportedBrowsers.chromium, headless=False, args=["--start-maximized"], timeout="12000")
        url = 'https://helloworld.org'
        browser.new_context(viewport=None)
        browser.new_page(url)
        browser.wait_for_elements_state("//span[text()=' Sign In ']")
        browser.get_title(AssertionOperator.equals,"Hello World")

Then when I call it via keyword (New Portal) in my robot file, the browser automatically exits and I got this Playwright-log:

{"level":30,"time":"2024-05-21T00:30:39.278Z","pid":19123,"hostname":"localhost","msg":"Listening on 57109"}
(node:19424) DeprecationWarning: Calling start() is no longer necessary. It can be safely omitted.
(Use `node --trace-deprecation ...` to show where the warning was created)
{"level":30,"time":"2024-05-21T00:30:39.316Z","pid":19424,"hostname":"localhost","msg":"Start of node method newBrowser"}
{"level":30,"time":"2024-05-21T00:30:39.525Z","pid":19424,"hostname":"localhost","msg":"Adding browser to stack: chromium, version: 12{"level":30,"time":"2024-05-21T00:30:43.742Z","pid":19393,"hostname":"localhost","msg":"Start of node method getBrowserCatalog"}
{"level":30,"time":"2024-05-21T00:30:43.742Z","pid":19393,"hostname":"localhost","msg":"End of node method getBrowserCatalog"}
{"level":30,"time":"2024-05-21T00:30:43.745Z","pid":19393,"hostname":"localhost","msg":"Start of node method fillText"}
================= Original suppressed error =================
Error: Could not find active page
      .....
=============================================================
{"level":30,"time":"2024-05-21T00:30:43.745Z","pid":19393,"hostname":"localhost","msg":"Error of node method  {"level":30,"time":"2024-05-21T00:30:43.774Z","pid":19424,"hostname":"localhost","msg":"Start of node method closeAllBrowsers"}
{"level":30,"time":"2024-05-21T00:30:43.778Z","pid":19424,"hostname":"localhost","msg":"Removed page=5ee3e530-7414-486f-81d1-8a60b71b7b6c from context=6fcad607-b5e1-41c7-aef0-04eb91198b2c page stack"}
{"level":30,"time":"2024-05-21T00:30:43.869Z","pid":19424,"hostname":"localhost","msg":"End of node method closeAllBrowsers"}

I think it has something to do with this, but I don’t know why.

{"level":30,"time":"2024-05-21T00:30:39.316Z","pid":19424,"hostname":"localhost","msg":"Start of node method newBrowser"}
{"level":30,"time":"2024-05-21T00:30:39.525Z","pid":19424,"hostname":"localhost","msg":"Adding browser to stack: chromium, version: 12{"level":30,"time":"2024-05-21T00:30:43.742Z","pid":19393,"hostname":"localhost","msg":"Start of node method getBrowserCatalog"}
{"level":30,"time":"2024-05-21T00:30:43.742Z","pid":19393,"hostname":"localhost","msg":"End of node method getBrowserCatalog"}

I also observed that every time I run this, there is additional node created or there two nodes that are running at the same time. (19393 and 19424)

I also tried running New Browser keywords like the following:

New Browser     chromium    headless=false       args=["--start-maximized"]
New Context     viewport=${None}
New Page     ${url}

And it just works fine with only one node running at the background.

Please help me with this. Thank you in advance! :slight_smile: