How to prevent browser closing just after launching in playwright (sync) python?

Viewed 1136

I have placed launch browser under init method of a class A

def __init__(self):
    browser = launch syntax 

and another method2 I have some operation to perform

I want to call method2 after initiating object for class A but after creating an Object of class browser is getting closed. How to stop closing the browser in sync mode??

1 Answers

A similar Question about this issue

Anyway, once the instance vanishes as well the browser does. You need to make sure class A is still loaded, also from the code sample you posted it is quite hard to understand the problem, because it would be on the wider context.

Related