Skip to content

Commit fc40f94

Browse files
committed
Convert Tear Down Playwright action to async function
1 parent 88fa082 commit fc40f94

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Framework/Built_In_Automation/Web/Playwright/BuiltInFunctions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ async def Go_To_Link(step_data):
303303

304304

305305
@logger
306-
def Tear_Down_Playwright(step_data=None):
306+
async def Tear_Down_Playwright(step_data=None):
307307
"""
308308
Close browser and clean up Playwright resources.
309309
@@ -320,34 +320,34 @@ def Tear_Down_Playwright(step_data=None):
320320
for page_id, details in playwright_details.items():
321321
try:
322322
if details.get("page"):
323-
details["page"].close()
323+
await details["page"].close()
324324
if details.get("context"):
325-
details["context"].close()
325+
await details["context"].close()
326326
except Exception:
327327
pass
328328

329329
# Close main instances
330330
try:
331331
if current_page and current_page not in [d.get("page") for d in playwright_details.values()]:
332-
current_page.close()
332+
await current_page.close()
333333
except Exception:
334334
pass
335335

336336
try:
337337
if context:
338-
context.close()
338+
await context.close()
339339
except Exception:
340340
pass
341341

342342
try:
343343
if browser:
344-
browser.close()
344+
await browser.close()
345345
except Exception:
346346
pass
347347

348348
try:
349349
if playwright_instance:
350-
playwright_instance.stop()
350+
await playwright_instance.stop()
351351
except Exception:
352352
pass
353353

0 commit comments

Comments
 (0)