robotframework / robotframework/SeleniumLibrary

stubs are completely broken

Open
#1,919 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Python
Stars
1.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

it looks like whatever is being used to generate the stubs is completely broken. for example the type annotations in SeleniumLibrary/__init__.pyi are mostly invalid:

class SeleniumLibrary:
    def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional] = None, plugins: Optional[Optional] = None, event_firing_webdriver: Optional[Optional] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25)): ...
    def add_cookie(self, name: str, value: str, path: Optional[Optional] = None, domain: Optional[Optional] = None, secure: Optional[Optional] = None, expiry: Optional[Optional] = None): ...
    
    ...
    
    def click_button(self, locator: Union, modifier: Union = False): ...
    def click_element(self, locator: Union, modifier: Union = False, action_chain: bool = False): ...
    def click_element_at_coordinates(self, locator: Union, xoffset: int, yoffset: int): ...
    def click_image(self, locator: Union, modifier: Union = False): ...
    def click_link(self, locator: Union, modifier: Union = False): ...
  • Optional[Optional] isn't valid. the correct usage would be something like Optional[int] (though Optional is deprecated in favor of the new union syntax eg. int | None)
  • Union is not valid as a type on its own. it should be something like Union[int, str] (which is deprecated in favor of int | str)
  • i see that __init__.py contains type annotations, so the generated stubs should not be needed and can probably just be deleted
  • a py.typed file is also required for type checkers to treat the package as typed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the annotations in SeleniumLibrary/init.py with the generated SeleniumLibrary/init.pyi, then review how the stubs are produced and packaged. Check the typing specification linked in the issue for py.typed requirements. Done means the distributed type information is valid and type checkers can recognize the package as typed, whether the stubs are corrected or removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.