Skip to content

Commit

Permalink
also wait promise result
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Apr 10, 2021
1 parent a4f7826 commit 794cec9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion element.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (el *Element) WaitInteractable() (pt *proto.Point, err error) {
// Wait until the js returns true
func (el *Element) Wait(opts *EvalOptions) error {
return utils.Retry(el.ctx, el.sleeper(), func() (bool, error) {
res, err := el.Evaluate(opts.This(el.Object))
res, err := el.Evaluate(opts.ByPromise().This(el.Object))
if err != nil {
return true, err
}
Expand Down
2 changes: 1 addition & 1 deletion page.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func (p *Page) EvalOnNewDocument(js string) (remove func() error, err error) {
// Wait until the js returns true
func (p *Page) Wait(this *proto.RuntimeRemoteObject, js string, params []interface{}) error {
return utils.Retry(p.ctx, p.sleeper(), func() (bool, error) {
opts := Eval(js, params...).This(this)
opts := Eval(js, params...).ByPromise().This(this)

res, err := p.Evaluate(opts)
if err != nil {
Expand Down

0 comments on commit 794cec9

Please sign in to comment.