Skip to content

Commit 88fa082

Browse files
committed
Fix Playwright drag and drop action
1 parent 3788a8b commit 88fa082

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

Framework/Built_In_Automation/Web/Playwright/BuiltInFunctions.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,27 +1961,25 @@ async def drag_and_drop(step_data):
19611961
return "zeuz_failed"
19621962

19631963
# Separate source and target parameters
1964-
source_params = []
1965-
target_params = []
1964+
source_param = None
1965+
target_param = None
19661966

19671967
for left, mid, right in step_data:
19681968
mid_l = mid.strip().lower()
1969-
if mid_l == "target parameter":
1970-
target_params.append((left, "element parameter", right))
1971-
elif mid_l == "element parameter":
1972-
source_params.append((left, mid, right))
1973-
else:
1974-
source_params.append((left, mid, right))
1975-
target_params.append((left, mid, right))
1969+
if "element parameter" in mid_l:
1970+
if mid_l.startswith("dst"):
1971+
target_param = left.strip()
1972+
elif mid_l.startswith("src"):
1973+
source_param = left.strip()
19761974

19771975
# Get source element
1978-
source_locator = await PlaywrightLocator.Get_Element(source_params, current_page)
1976+
source_locator = await PlaywrightLocator.Get_Element(source_param, current_page)
19791977
if source_locator == "zeuz_failed":
19801978
CommonUtil.ExecLog(sModuleInfo, "Source element not found", 3)
19811979
return "zeuz_failed"
19821980

19831981
# Get target element
1984-
target_locator = await PlaywrightLocator.Get_Element(target_params, current_page)
1982+
target_locator = await PlaywrightLocator.Get_Element(target_param, current_page)
19851983
if target_locator == "zeuz_failed":
19861984
CommonUtil.ExecLog(sModuleInfo, "Target element not found", 3)
19871985
return "zeuz_failed"

0 commit comments

Comments
 (0)