From f59c1f7a87e3567469a009c6d153993b0b82405e Mon Sep 17 00:00:00 2001 From: ankur22 Date: Thu, 4 Jan 2024 15:12:22 +0000 Subject: [PATCH] Add internal timeout method This method will be used in the mapping layer to instantiate a FrameFillOptions. --- common/locator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/locator.go b/common/locator.go index 2de064ce7..04bb19533 100644 --- a/common/locator.go +++ b/common/locator.go @@ -3,6 +3,7 @@ package common import ( "context" "fmt" + "time" "github.com/grafana/xk6-browser/k6ext" "github.com/grafana/xk6-browser/log" @@ -51,6 +52,11 @@ func (l *Locator) Clear(opts *FrameFillOptions) error { return nil } +// Timeout will return the default timeout or the one set by the user. +func (l *Locator) Timeout() time.Duration { + return l.frame.defaultTimeout() +} + // Click on an element using locator's selector with strict mode on. func (l *Locator) Click(opts goja.Value) error { l.log.Debugf("Locator:Click", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)