Skip to content

[py] Type event firing script execution results#17536

Open
adamtheturtle wants to merge 1 commit into
SeleniumHQ:trunkfrom
adamtheturtle:codex/type-script-results
Open

[py] Type event firing script execution results#17536
adamtheturtle wants to merge 1 commit into
SeleniumHQ:trunkfrom
adamtheturtle:codex/type-script-results

Conversation

@adamtheturtle
Copy link
Copy Markdown
Contributor

Summary

Add explicit Any return annotations to EventFiringWebDriver.execute_script and execute_async_script.

Details

The wrapped WebDriver methods return arbitrary JavaScript result values, not only dictionaries. The base WebDriver methods are already annotated as returning Any; this updates the event-firing wrapper to match that public API and avoid untyped wrapper methods.

Validation

  • uv run --with ruff ruff check --config py/pyproject.toml py/selenium/webdriver/support/event_firing_webdriver.py
  • python3 -m compileall -q py/selenium/webdriver/support/event_firing_webdriver.py

@selenium-ci selenium-ci added C-py Python Bindings B-support Issue or PR related to support classes labels May 21, 2026
@selenium-ci
Copy link
Copy Markdown
Member

Thank you, @adamtheturtle for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@adamtheturtle adamtheturtle marked this pull request as ready for review May 21, 2026 09:09
@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add return type annotations to event firing script methods

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add explicit Any return type annotations to script execution methods
• Align EventFiringWebDriver type hints with base WebDriver API
• Add missing type hint for script parameter in execute_async_script
Diagram
flowchart LR
  A["EventFiringWebDriver methods"] -- "Add Any return type" --> B["execute_script"]
  A -- "Add Any return type + script type hint" --> C["execute_async_script"]
  B -- "Match base WebDriver API" --> D["Type consistency"]
  C -- "Match base WebDriver API" --> D

Loading

File Changes

1. py/selenium/webdriver/support/event_firing_webdriver.py ✨ Enhancement +2/-2

Add return type annotations to script execution methods

• Add -> Any return type annotation to execute_script method
• Add -> Any return type annotation to execute_async_script method
• Add missing script: str type hint parameter to execute_async_script
• Align wrapper method signatures with base WebDriver public API

py/selenium/webdriver/support/event_firing_webdriver.py


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented May 21, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-support Issue or PR related to support classes C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants