Skip to content

refactor crawler.py::do_something() #545

Description

@nnrepos

the function do_something is not very clear:

  • it interacts with with elements on the driver's page, clicks it /send_keys to it, and then returns the attributes of the first child that was not interacted with yet.
  • it relies on a global variable already_clicked_elems.
  • it doesn't have a docstring or a meaningful name.

i think that, before creating a test for that method, we should first refactor it. a few options:

  • refactor crawler.py into a Crawler class, and keep the already_clicked_elems as a member;
  • refactor just do_something by making it yield a child's attributes, that way a set is no longer needed;
  • leave the global variable there for now and just focus on documentation.

either way, i think the function should be:

  • renamed to something like interact_with_clickable_chlid,
  • given proper documentation + docstring,
  • given type hints.

let me know what you think 🧇

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions