mirror of
https://github.com/MontFerret/ferret.git
synced 2025-06-23 00:28:10 +02:00
Fixed WAIT_CLASS args validation (#192)
This commit is contained in:
@ -43,6 +43,13 @@ func WaitClass(_ context.Context, args ...core.Value) (core.Value, error) {
|
||||
// lets figure out what is passed as 1st argument
|
||||
switch args[0].(type) {
|
||||
case *dynamic.HTMLDocument:
|
||||
// revalidate args with more accurate amount
|
||||
err := core.ValidateArgs(args, 3, 4)
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
}
|
||||
|
||||
// class
|
||||
err = core.ValidateType(args[2], core.StringType)
|
||||
|
||||
@ -86,7 +93,7 @@ func WaitClass(_ context.Context, args ...core.Value) (core.Value, error) {
|
||||
return values.None, err
|
||||
}
|
||||
|
||||
timeout = args[3].(values.Int)
|
||||
timeout = args[2].(values.Int)
|
||||
}
|
||||
|
||||
return values.None, el.WaitForClass(class, timeout)
|
||||
|
Reference in New Issue
Block a user