Skip to content

Conversation

@emanlove
Copy link
Member

As noted in #1962 chaining or cascading locators has been broken for a while. This PR addresses the problem.

- Fixed a couple incorrectly modified type hints on click button
  and click image
- Added type hints to get webelement(s) keywords
@emanlove emanlove added this to the Mar 2025 milestone Jan 19, 2026
@emanlove emanlove added bug acknowledge To be acknowledged in release notes labels Jan 19, 2026
Copy link
Member

@yuriverweij yuriverweij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already importing typing, so this could be simplified for us.

from typing import TypeAlias
from selenium.webdriver.remote.webelement import WebElement

Locator: TypeAlias = WebElement | str | list["Locator"]

The we can use
locator: Locator

@emanlove
Copy link
Member Author

Rethinking what you are saying Yuri and see your point. Thinking we could make that in src/SeleniumLibrary/utils/types.py and import in the various files from there. Honestly not sure what the difference is between using this TypeAlias versus making our own type. As I mentioned to tatu in a DM types are a weak point of mine that I need to learn more ..

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

Labels

acknowledge To be acknowledged in release notes bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants