mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-05 00:49:00 +02:00
Added errors to ClickX methods and added existence check (#341)
* Added errors to ClickX methods and added existence check * Fixes * Return None from Iterator when an error occurs
This commit is contained in:
@ -25,7 +25,17 @@ func ClickAll(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return values.None, err
|
||||
}
|
||||
|
||||
selector := args[1].String()
|
||||
selector := values.ToString(args[1])
|
||||
|
||||
return doc.ClickBySelectorAll(ctx, values.NewString(selector))
|
||||
exists, err := doc.ExistsBySelector(ctx, selector)
|
||||
|
||||
if err != nil {
|
||||
return values.False, err
|
||||
}
|
||||
|
||||
if !exists {
|
||||
return values.False, nil
|
||||
}
|
||||
|
||||
return values.True, doc.ClickBySelectorAll(ctx, selector)
|
||||
}
|
||||
|
Reference in New Issue
Block a user