Skip to content

[Bug]: Type checker assumes tab.find(raise_exc=False) returns a list instead of a single WebElement #307

@SZRabinowitz

Description

@SZRabinowitz

Checklist before reporting

  • I have searched for similar issues and didn't find a duplicate.
  • I have updated to the latest version of pydoll to verify the issue still exists.

pydoll Version

2.12.1 (I think)

Python Version

3.13

Operating System

Windows

Bug Description

Type checker assumes tab.find() returns a list instead of a single WebElement when passing raise_exc=False

I think this can be solved by reordering the overloads but I didnt look into it yet.

Steps to Reproduce

call tab.find with pylance in vscode

Code Example

from pydoll.browser import Chrome


browser = Chrome()

async def test():
    tab = await browser.new_tab()
    elem = await tab.find("anything", raise_exc=False) # (variable) elem: list[WebElement] | None

Expected Behavior

No response

Actual Behavior

No response

Relevant Log Output

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions