Skip to content

Commit ce4d72b

Browse files
authored
Merge pull request #655 from AutomationSolutionz/claude/review-repo-contents-ddPPA
Add Playwright support as alternative web automation driver
2 parents f572524 + 45316e5 commit ce4d72b

6 files changed

Lines changed: 3201 additions & 0 deletions

File tree

Framework/Built_In_Automation/Sequential_Actions/action_declarations/info.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
desktop,
66
rest,
77
selenium,
8+
playwright,
89
utility,
910
windows,
1011
linux,
@@ -20,6 +21,7 @@
2021
desktop,
2122
rest,
2223
selenium,
24+
playwright,
2325
utility,
2426
windows,
2527
linux,
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""
2+
Playwright Action Declarations
3+
4+
Defines all available Playwright actions for the Zeuz Node framework.
5+
Users can switch from Selenium to Playwright by changing "selenium action" to "playwright action"
6+
in their test steps while keeping all other parameters the same.
7+
8+
Author: Zeuz/AutomationSolutionz
9+
"""
10+
11+
declarations = (
12+
# Browser Management
13+
{ "name": "open browser", "function": "Open_Browser", "screenshot": "web" },
14+
{ "name": "go to link", "function": "Go_To_Link", "screenshot": "web" },
15+
{ "name": "tear down browser", "function": "Tear_Down_Playwright", "screenshot": "none" },
16+
{ "name": "teardown", "function": "Tear_Down_Playwright", "screenshot": "none" },
17+
{ "name": "switch browser", "function": "Switch_Browser", "screenshot": "none" },
18+
19+
# Click Actions
20+
{ "name": "click", "function": "Click_Element", "screenshot": "web" },
21+
{ "name": "double click", "function": "Double_Click_Element", "screenshot": "web" },
22+
{ "name": "right click", "function": "Right_Click_Element", "screenshot": "web" },
23+
{ "name": "hover", "function": "Hover_Over_Element", "screenshot": "web" },
24+
25+
# Text Input
26+
{ "name": "text", "function": "Enter_Text_In_Text_Box", "screenshot": "web" },
27+
{ "name": "keystroke keys", "function": "Keystroke_For_Element", "screenshot": "web" },
28+
{ "name": "keystroke chars", "function": "Keystroke_For_Element", "screenshot": "web" },
29+
30+
# Validation
31+
{ "name": "validate full text", "function": "Validate_Text", "screenshot": "web" },
32+
{ "name": "validate partial text", "function": "Validate_Text", "screenshot": "web" },
33+
{ "name": "if element exists", "function": "if_element_exists", "screenshot": "web" },
34+
35+
# Element Information
36+
{ "name": "save attribute", "function": "Save_Attribute", "screenshot": "web" },
37+
{ "name": "get element info", "function": "get_element_info", "screenshot": "web" },
38+
{ "name": "extract table data", "function": "Extract_Table_Data", "screenshot": "web" },
39+
40+
# Navigation
41+
{ "name": "navigate", "function": "Navigate", "screenshot": "web" },
42+
{ "name": "get current url", "function": "Get_Current_URL", "screenshot": "none" },
43+
44+
# Scrolling
45+
{ "name": "scroll", "function": "Scroll", "screenshot": "web" },
46+
{ "name": "scroll to element", "function": "scroll_to_element", "screenshot": "web" },
47+
{ "name": "scroll element to top", "function": "scroll_to_element", "screenshot": "web" },
48+
49+
# Selection (Dropdowns/Checkboxes)
50+
{ "name": "select by visible text", "function": "Select_Deselect", "screenshot": "web" },
51+
{ "name": "deselect by visible text", "function": "Select_Deselect", "screenshot": "web" },
52+
{ "name": "select by value", "function": "Select_Deselect", "screenshot": "web" },
53+
{ "name": "deselect by value", "function": "Select_Deselect", "screenshot": "web" },
54+
{ "name": "select by index", "function": "Select_Deselect", "screenshot": "web" },
55+
{ "name": "deselect by index", "function": "Select_Deselect", "screenshot": "web" },
56+
{ "name": "deselect all", "function": "Select_Deselect", "screenshot": "web" },
57+
{ "name": "check uncheck", "function": "check_uncheck", "screenshot": "web" },
58+
59+
# Window/Tab Management
60+
{ "name": "switch window", "function": "switch_window_or_tab", "screenshot": "web" },
61+
{ "name": "switch window or frame", "function": "switch_window_or_tab", "screenshot": "web" },
62+
{ "name": "switch window/tab", "function": "switch_window_or_tab", "screenshot": "web" },
63+
{ "name": "open new tab", "function": "open_new_tab", "screenshot": "web" },
64+
{ "name": "close tab", "function": "close_tab", "screenshot": "web" },
65+
66+
# iframe Handling
67+
{ "name": "switch iframe", "function": "switch_iframe", "screenshot": "web" },
68+
69+
# Alerts/Dialogs
70+
{ "name": "handle alert", "function": "Handle_Browser_Alert", "screenshot": "desktop" },
71+
72+
# Drag and Drop
73+
{ "name": "drag and drop", "function": "drag_and_drop", "screenshot": "web" },
74+
75+
# Screenshots
76+
{ "name": "take screenshot web", "function": "take_screenshot_playwright", "screenshot": "web" },
77+
78+
# JavaScript
79+
{ "name": "execute javascript", "function": "execute_javascript", "screenshot": "web" },
80+
81+
# File Upload
82+
{ "name": "upload file", "function": "upload_file", "screenshot": "web" },
83+
84+
# Window Management
85+
{ "name": "resize window", "function": "resize_window", "screenshot": "web" },
86+
87+
# Wait Actions
88+
{ "name": "wait for element", "function": "Wait_For_Element", "screenshot": "web" },
89+
90+
# Tracing/Performance (Playwright-specific)
91+
{ "name": "start tracing", "function": "Start_Tracing", "screenshot": "none" },
92+
{ "name": "stop tracing", "function": "Stop_Tracing", "screenshot": "none" },
93+
94+
# Network Interception (Playwright-specific)
95+
{ "name": "intercept network", "function": "Intercept_Network", "screenshot": "none" },
96+
) # yapf: disable
97+
98+
module_name = "playwright"
99+
100+
for dec in declarations:
101+
dec["module"] = module_name

Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def load_sa_modules(
121121
from Framework.Built_In_Automation.Web.Selenium import (
122122
BuiltInFunctions as selenium,
123123
)
124+
elif module == "playwright":
125+
global playwright
126+
from Framework.Built_In_Automation.Web.Playwright import (
127+
BuiltInFunctions as playwright,
128+
)
124129
elif module == "rest":
125130
global rest
126131
from Framework.Built_In_Automation.Web.REST import BuiltInFunctions as rest

0 commit comments

Comments
 (0)