Skip to content

Commit

Permalink
Refactor needsinput into a const
Browse files Browse the repository at this point in the history
  • Loading branch information
bandorko authored and ankur22 committed Mar 11, 2024
1 parent 2a42ab7 commit 1592cf3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/element_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

const resultDone = "done"
const resultNeedsInput = "needsinput"

type (
elementHandleActionFunc func(context.Context, *ElementHandle) (any, error)
Expand Down Expand Up @@ -271,7 +272,7 @@ func (h *ElementHandle) fill(_ context.Context, value string) error {
return fmt.Errorf("unexpected type %T", result)
}

if s == "needsinput" {
if s == resultNeedsInput {
h.frame.page.Keyboard.InsertText(value)
} else if s != resultDone {
// Either we're done or an error happened (returned as "error:..." from JS)
Expand Down

0 comments on commit 1592cf3

Please sign in to comment.