Skip to content

Commit c26b182

Browse files
committed
Added playwright conditional action handler
1 parent cdd9c58 commit c26b182

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,37 @@ async def Conditional_Action_Handler(step_data, dataset_cnt):
19841984
logic_decision = False
19851985
log_msg += "Element is not found\n"
19861986

1987+
elif module == "playwright":
1988+
try:
1989+
from Framework.Built_In_Automation.Web.Playwright import locator as PlaywrightLocator
1990+
from Framework.Built_In_Automation.Web.Playwright.BuiltInFunctions import current_page
1991+
1992+
wait = 10
1993+
for left, mid, right in data_set:
1994+
mid = mid.lower()
1995+
left = left.lower()
1996+
if "optional parameter" in mid and "wait" in left:
1997+
wait = float(right.strip())
1998+
1999+
if current_page is None:
2000+
CommonUtil.ExecLog(sModuleInfo, "No browser open for Playwright conditional action", 3)
2001+
logic_decision = False
2002+
log_msg += "Browser not open\n"
2003+
else:
2004+
Element = await PlaywrightLocator.Get_Element(data_set, current_page, element_wait=wait)
2005+
if Element == "zeuz_failed":
2006+
CommonUtil.ExecLog(sModuleInfo, "Conditional Actions could not find the element", 3)
2007+
logic_decision = False
2008+
log_msg += "Element is not found\n"
2009+
else:
2010+
logic_decision = True
2011+
log_msg += "Element is found\n"
2012+
2013+
except: # Element doesn't exist, proceed with the step data following the fail/false path
2014+
CommonUtil.ExecLog(sModuleInfo, "Conditional Actions could not find the element", 3)
2015+
logic_decision = False
2016+
log_msg += "Element is not found\n"
2017+
19872018
elif module == "windows":
19882019
try:
19892020
from Framework.Built_In_Automation.Desktop.Windows import BuiltInFunctions
@@ -2186,7 +2217,7 @@ async def Conditional_Action_Handler(step_data, dataset_cnt):
21862217
2
21872218
)
21882219
if data_set_index not in inner_skip:
2189-
result, skip = Run_Sequential_Actions(
2220+
result, skip = await Run_Sequential_Actions(
21902221
[data_set_index]
21912222
) # Running
21922223
inner_skip = list(set(inner_skip + skip))

0 commit comments

Comments
 (0)