Skip to content

Commit cdd9c58

Browse files
committed
Patch Playwright Wait For Element action with sleep
1 parent fc40f94 commit cdd9c58

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Framework/Built_In_Automation/Web/Playwright/BuiltInFunctions.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Author: Zeuz/AutomationSolutionz
2121
"""
2222

23+
import asyncio
2324
import sys
2425
import os
2526
import inspect
@@ -2313,11 +2314,13 @@ async def Wait_For_Element(step_data):
23132314
if mid_l == "input parameter":
23142315
if left_l in ("wait", "state"):
23152316
state = right_v.lower()
2316-
elif mid_l == "optional parameter":
2317-
if left_l == "timeout":
2318-
timeout = int(float(right_v) * 1000)
2317+
elif left_l == "wait for element":
2318+
timeout = int(right_v)
23192319

2320-
locator = await PlaywrightLocator.Get_Element(step_data, current_page, element_wait=0.1)
2320+
if timeout:
2321+
await asyncio.sleep(timeout)
2322+
2323+
locator = await PlaywrightLocator.Get_Element(step_data, current_page)
23212324

23222325
if locator == "zeuz_failed":
23232326
# For hidden/detached states, element not found is actually success
@@ -2327,11 +2330,11 @@ async def Wait_For_Element(step_data):
23272330
CommonUtil.ExecLog(sModuleInfo, "Element not found", 3)
23282331
return "zeuz_failed"
23292332

2330-
wait_options = {"state": state}
2331-
if timeout:
2332-
wait_options["timeout"] = timeout
2333+
# wait_options = {"state": state}
2334+
# if timeout:
2335+
# wait_options["timeout"] = timeout
23332336

2334-
locator.wait_for(**wait_options)
2337+
# locator.wait_for(**wait_options)
23352338
CommonUtil.ExecLog(sModuleInfo, f"Element reached state: {state}", 1)
23362339
return "passed"
23372340

0 commit comments

Comments
 (0)