Skip to content

Playwright new actions#695

Merged
nasif-z merged 6 commits into
playwright-selenium-parityfrom
playwright-new-actions
May 24, 2026
Merged

Playwright new actions#695
nasif-z merged 6 commits into
playwright-selenium-parityfrom
playwright-new-actions

Conversation

@mnahsanofficial
Copy link
Copy Markdown
Collaborator

@mnahsanofficial mnahsanofficial commented May 20, 2026

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made.
  • Version number has been updated.
  • Required modules have been added to respective "requirements*.txt" files. (N/A — no new dependencies)
  • Relevant Test Cases added to this description (below).
  • (Team) Label with affected action categories and semver status.

Overview

Adds Playwright implementations for five existing Selenium web actions so test steps can use playwright action with the same parameters as Selenium.

New Playwright actions

Action name Function
scroll to top scroll_to_top
save attribute values in list save_attribute_values_in_list
save web elements in list save_web_elements_in_list
multiple check uncheck multiple_check_uncheck
change attribute value Change_Attribute_Value

Behavior

  • Matches Selenium semantics: parent-scoped element search, target parameter parsing, return / return_contains / return_does_not_contain filters, paired list layout, and per-target check/uncheck with skip-on-failure.
  • Playwright locator module supports parent_locator scoping and option rows (e.g. allow hidden) for nested lookups.
  • Each action includes docstrings with Field / Sub Field / Value examples (same style as Select_Deselect).
  • Actions are registered in action_declarations/playwright.py.

Files touched (core)

  • Framework/Built_In_Automation/Web/Playwright/BuiltInFunctions.py
  • Framework/Built_In_Automation/Web/Playwright/locator.py
  • Framework/Built_In_Automation/Sequential_Actions/action_declarations/playwright.py

Breaking changes: None. Selenium steps are unchanged. Playwright steps must use playwright action on the action row.

Related work: TASK-2852

Selenium-Parity Update — Existing Playwright Actions

Backfills missing Selenium-supported parameters/options on ten existing Playwright actions, plus a new Open_Electron_App action so Electron apps can be launched from a playwright action step. All previous parameters keep working — these changes are additive.

Actions updated

Action name Function Selenium parameters / behavior added
click Click_Element use js now runs a real JS element.click() (was force=True); Selenium-style offset (percentage from element center); intercepted-click → JS-click fallback; stale-element retry up to 5× with 1s pauses.
text Enter_Text_In_Text_Box Click element first to focus and re-click after entering (some inputs go unclickable post-fill); platform-aware Cmd+A / Ctrl+A + Delete clear path; JS-set value path escapes backticks / ${; per-keystroke delay honored when clearing.
save attribute Save_Attribute Selenium-style API now works: (attribute_name, save parameter, variable_name); added tag attribute (lower-cased tag name); legacy Playwright input parameter form still supported.
save attribute values in list save_attribute_values_in_list Verified parity — already supports return, return_contains, return_does_not_contain, allow hidden, allow disable, paired. No code change required.
if element exists if_element_exists Selenium value=variable_name action format — writes the value to a shared variable on match, "false" on miss, always returns passed. Plain form (no =) still returns passed / zeuz_failed.
wait for element Wait_For_Element Bug fix: the actual locator.wait_for(state=…) call was previously commented out and replaced with asyncio.sleep. Now really waits. Reads timeout from the action value (Selenium style), timeout optional parameter, or element_wait shared variable. Supports attached / detached / visible / hidden.
switch iframe switch_iframe Index lookup retries up to 5×, 2s apart (waits for late-loading iframes); negative indexes supported (-1 = last iframe); walks back to parent frame and retries when a target can't be resolved in the current context (matches Selenium's switch_to.parent_frame() loop).
scroll to element scroll_to_element Added method (js / webdriver / action chain), additional scroll (fraction of viewport) with auto-direction detection. align to top and use js still work.
go to link Go_To_Link Added wait time to appear element / wait for element (sets element_wait shared variable), wait time to page load (alias of timeout), resolution (WxH or W,Hset_viewport_size); timeout now also applied via set_default_navigation_timeout / set_default_timeout.
drag and drop drag_and_drop Full source/destination parameter support: src / source / dst / destination prefixes × element / parent / child / sibling parameters (was previously only dst/src element parameter). Added destination offset (x,y percentage of half the destination's size from its center) and delay (seconds) — pauses while holding source over destination before releasing. allow disable / allow hidden options forwarded to both locators.
open electron app (new) Open_Electron_App Launches an Electron desktop app via Playwright's _electron.launch(...). Mirrors Selenium's per-OS windows / mac / linux path rows. Supports session / driver id, repeatable add argument, cwd, env (KEY=VALUE), timeout, record video / video dir. First Electron BrowserWindow becomes the active page, so downstream element / click / text actions work as in a normal browser session. Registered in action_declarations/playwright.py.

Files touched (this update)

  • Framework/Built_In_Automation/Web/Playwright/BuiltInFunctions.py
  • Framework/Built_In_Automation/Sequential_Actions/action_declarations/playwright.py

Breaking changes: None. All previous Playwright step formats continue to work; the additions are Selenium-compatible aliases and behaviors.

Test Cases

Manual verification recommended (use playwright action instead of selenium action):

  1. scroll to top — Open a long page, scroll down, run action; confirm window.pageYOffset is 0 and logs show scroll coordinates.
  2. save attribute values in list — Under a parent container, collect text/attributes from multiple target parameter groups into a shared variable; verify list shape (paired / unpaired).
  3. save web elements in list — Save locators with optional return_contains / return_does_not_contain filters; reuse saved locators in a later click/text step.
  4. multiple check uncheck — Parent + target parameter tuples (field, value, check|uncheck); verify skip when already checked/unchecked and JS fallback when click is intercepted.
  5. change attribute value — Set value (or other property) on an input via input parameter rows; confirm DOM property update.
  6. click — use js — Click a button with use js / optional parameter / true; confirm a real JS element.click() is dispatched (e.g. an overlay-covered button still fires its handler).
  7. click — offset — Click (offset, optional parameter, 50,0) on a wide element; confirm the click lands right of center (Selenium-style percentage from center).
  8. click — intercepted fallback — Place a transparent overlay above a button; native click times out, JS-click fallback succeeds and a warning is logged.
  9. text — clear + delay — Fill a populated input with clear / true and delay / 0.1; verify the old value is cleared via Select-All+Delete and characters arrive one at a time.
  10. save attribute — Selenium API — Use (text, save parameter, my_var) and (tag, save parameter, my_tag) rows; confirm my_var holds the element text and my_tag holds the lower-cased tag name.
  11. if element exists — variable form — Action value true=my_flag on a present element sets my_flag = "true" and the step passes; same step against a missing element sets my_flag = "false" and the step still passes.
  12. wait for element — hidden state — Trigger a loading spinner, run with wait / hidden and timeout / 10; step passes once the spinner detaches/hides (verifies the bug fix).
  13. switch iframe — nested + retry — Two iframe rows for nested frames; load the inner frame slowly to confirm the 5×2s retry and negative-index resolution work.
  14. scroll to element — additional scroll — Use method / js, align to top / true, additional scroll / 0.1 near the page bottom; element comes into view and an extra ~10% viewport scroll follows.
  15. go to link — wait params + resolution — Provide wait time to appear element / 15, wait time to page load / 60, resolution / 1280,720; confirm element_wait shared variable is 15, default page timeout is applied, and the viewport is resized.
  16. drag and drop — offset + delay — Use src parent parameter + dst element parameter rows, destination offset / 25,0 and delay / 0.5; confirm drop lands right of the destination center and the hold pause is observable.
  17. open electron app — Provide per-OS path rows for an Electron app (only the row matching the running OS is used); confirm the first BrowserWindow becomes the active page and a subsequent click step interacts with it.

@Antu7
Copy link
Copy Markdown
Collaborator

Antu7 commented May 22, 2026

🔎 ZeuZ PR Review

Open the full report in ZeuZ: Review findings and apply suggestions

Overview Value
Agents ✅ 4 completed
Suggestions 💡 3

Agent breakdown

→ General Review

Status: ✅ Completed
Suggestions: 1 suggestion

One high-severity regression stands out: the new Electron launcher uses a private Playwright attribute, which is likely to fail at runtime and make the new action unusable. I didn’t find other issues with comparable confidence in the diff.

→ Security Review

Status: ✅ Completed
Suggestions: 0 suggestions

No security findings in the PR diff. The new Playwright actions reuse existing session and locator flows without introducing clear injection, auth, or secret-handling regressions.

→ Performance Review

Status: ✅ Completed
Suggestions: 1 suggestion

One scalability issue: the single-target list extraction path unnecessarily transposes the full result matrix, creating extra work and memory churn for large element sets.

→ Testing Review

Status: ✅ Completed
Suggestions: 1 suggestion

The PR adds several new Playwright actions and significantly expands existing action behavior, but there are no corresponding tests for the new branches or regression paths. The current test suite only covers session activation and iframe switching, so the new public actions and fallback logic are unprotected.

Open ZeuZ to inspect full findings, continue an agent conversation, or apply safe patch suggestions.

@Antu7
Copy link
Copy Markdown
Collaborator

Antu7 commented May 22, 2026

🔎 ZeuZ PR Review

Open the full report in ZeuZ: Review findings and apply suggestions

Overview Value
Agents ✅ 4 completed
Suggestions 💡 5

Agent breakdown

→ General Review

Status: ✅ Completed
Suggestions: 2 suggestions

Mostly solid expansion of Playwright actions, but I found one clear Selenium-compatibility regression and one likely Electron-launch compatibility risk. The text-saving path now returns raw textContent instead of visible text, which can change existing assertions. The new Electron launcher also forwards options that are not part of Playwright’s Electron launch API, so those steps may fail when users supply the new optional parameters.

→ Security Review

Status: ✅ Completed
Suggestions: 1 suggestion

One warning: the updated text-entry flow now logs the full input value, which can leak secrets or other sensitive data into application logs. No critical injection or auth issues stood out in the diff.

→ Performance Review

Status: ✅ Completed
Suggestions: 0 suggestions

No material performance regressions found in the PR diff. The changes are mostly API/behavior additions; I did not see clear N+1 patterns, unbounded result sets, or hot-path algorithmic issues worth flagging.

→ Testing Review

Status: ✅ Completed
Suggestions: 2 suggestions

The PR adds several new Playwright actions and significantly changes core action behavior, but I couldn’t find tests that exercise those new entry points or the new fallback/compatibility paths.

Open ZeuZ to inspect full findings, continue an agent conversation, or apply safe patch suggestions.

@nasif-z nasif-z changed the base branch from playwright-async to playwright-selenium-parity May 24, 2026 15:25
@AutomationSolutionz AutomationSolutionz deleted a comment from Antu7 May 24, 2026
@AutomationSolutionz AutomationSolutionz deleted a comment from Antu7 May 24, 2026
@Antu7
Copy link
Copy Markdown
Collaborator

Antu7 commented May 24, 2026

🔎 ZeuZ PR Review

Open the full report in ZeuZ: Review findings and apply suggestions

Overview Value
Agents ✅ 4 completed
Suggestions 💡 3

Agent breakdown

→ General Review

Status: ✅ Completed
Suggestions: 2 suggestions

I found one high-confidence correctness regression and one behavior change that can mask failures. The Electron launch path also uses a private Playwright API, which is risky and likely to break across versions.

→ Security Review

Status: ✅ Completed
Suggestions: 0 suggestions

No security findings in the PR diff. The changes add new Playwright actions and parity behavior without introducing an obvious injection, authz, secret-handling, or exposure issue.

→ Performance Review

Status: ✅ Completed
Suggestions: 0 suggestions

No performance regressions or scalability issues stand out in this PR diff; the new actions are mostly session/session-state plumbing and per-action DOM work without obvious N+1, unbounded, or heavy-memory patterns.

→ Testing Review

Status: ✅ Completed
Suggestions: 1 suggestion

The PR adds several new Playwright actions and substantially changes navigation/click/text/attribute behavior, but I don’t see corresponding tests covering the new branches or regressions.

Open ZeuZ to inspect full findings, continue an agent conversation, or apply safe patch suggestions.

@nasif-z nasif-z merged commit 3d52ffb into playwright-selenium-parity May 24, 2026
3 checks passed
@nasif-z nasif-z deleted the playwright-new-actions branch May 24, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants