Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding fill-active-human #629

Closed
dgr opened this issue Aug 17, 2024 · 6 comments · Fixed by #635
Closed

Consider adding fill-active-human #629

dgr opened this issue Aug 17, 2024 · 6 comments · Fixed by #635

Comments

@dgr
Copy link
Contributor

dgr commented Aug 17, 2024

Problem/Opportunity
Currently, Etaoin has a fill-active API for filling in the active element. This is convenient because it automatically queries for the active element. Etaoin also has fill-human and fill-human-el APIs for filling a queried or specified element with human-like behavior (delays, typos, etc.). There is no convenience API for filling the active element while using human-like behavior, however.

Proposed Solution
Add a new API, fill-active-human that simply queries for the active element and then calls fill-human-el. Parameters would roughly match fill-human / fill-human-el, but without the query or element to fill (since that will be provided by the active element).

Alternative Solutions
The alternative is simply to leave things the way they are. fill-active-human is strictly a convenience API offering no fundamentally new functionality that cannot be achieved less-conveniently using existing APIs.

Action
I can submit a PR if this sounds like good functionality.

@lread
Copy link
Collaborator

lread commented Aug 17, 2024

Yeah, if this would be useful to you and others, Dave, feel free to submit a PR!

dgr added a commit to dgr/etaoin that referenced this issue Aug 20, 2024
lread added a commit that referenced this issue Aug 20, 2024
* Implement fill-active-human (#629)

* Update textarea field fill to use fill-active-human

---------

Co-authored-by: Lee Read <[email protected]>
@onetom
Copy link

onetom commented Aug 23, 2024

human- as a prefix would sound better, imho.
fill-active-human sounds a bit like joda speak...
or as if some "active human" would be being filled as a result of calling this function...

without being familiar with the implementation, i would even expect to just have a single as-human modifier macro, which would just do some dynamic binding to affect the how the fill function works.

@dgr
Copy link
Contributor Author

dgr commented Aug 23, 2024

IMO, there's no great solution here. First, I tried to make this fit in with Etaoin's existing naming scheme. Etaoin uses -human at the end of something to indicate that it uses human-like delays and mistakes to fill something in. Another reasonable, though less optimal, IMO, choice would have been fill-human-active, which I considered but rejected because of the way the other functions were named. That eliminates some of the "active human" issue. If somebody has real heartburn and wants to suggest an alternative name, I'd be open to that. I don't think the modifier macro is a good idea. My general philosophy is that functions should just do what they say they do, without modifying behavior based on dynamic global state.

@lread
Copy link
Collaborator

lread commented Aug 23, 2024

Sounds good, I don't think we want to rename/rework existing working functionality too much.
For example, there is the somewhat oddly named wait-has-text-everywhere, which is probably due to English not being the first language of the author, but the docstring explains its intent.

@dgr
Copy link
Contributor Author

dgr commented Aug 25, 2024

After staring at this some more, I think we should change names from fill-active-human to fill-human-active. I think that actually fits in better with the overall Etaoin naming scheme.

@onetom
Copy link

onetom commented Aug 26, 2024

fill-human-active has the same un-english-ness and ambiguity to it as fill-active-human, though, since we are not filling any humans here. human is just an adjective of fill.

but english is my 2nd language too, so my gut-feel is probably not the most representative in such matters.

First, I tried to make this fit in with Etaoin's existing naming scheme

it's not necessarily a good principle, if it became apparent over time, that the scheme was not the best...
im all for backwards compatibility, but also for intuitiveness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants