From bb548926c14a25ba6f9a340600b5eb3fe2554e12 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Thu, 23 Nov 2023 16:57:55 +0000 Subject: [PATCH] Remove the options on locator.isHidden It did accepts options which were strict and timeout. Strict is enabled and cannot be changed when working with the locator API. Timeout is no longer useful when working with isHidden. --- common/locator.go | 17 +++-------------- tests/locator_test.go | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/common/locator.go b/common/locator.go index cf6421fa5..1fa1ac769 100644 --- a/common/locator.go +++ b/common/locator.go @@ -246,14 +246,10 @@ func (l *Locator) IsVisible() (bool, error) { // IsHidden returns true if the element matches the locator's // selector and is hidden. Otherwise, returns false. -func (l *Locator) IsHidden(opts goja.Value) (bool, error) { - l.log.Debugf("Locator:IsHidden", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts) +func (l *Locator) IsHidden() (bool, error) { + l.log.Debugf("Locator:IsHidden", "fid:%s furl:%q sel:%q", l.frame.ID(), l.frame.URL(), l.selector) - copts := NewFrameIsHiddenOptions() - if err := copts.Parse(l.ctx, opts); err != nil { - return false, fmt.Errorf("parsing is hidden options: %w", err) - } - hidden, err := l.isHidden(copts) + hidden, err := l.frame.isHidden(l.selector, &FrameIsHiddenOptions{Strict: true}) if err != nil { return false, fmt.Errorf("checking is %q hidden: %w", l.selector, err) } @@ -261,13 +257,6 @@ func (l *Locator) IsHidden(opts goja.Value) (bool, error) { return hidden, nil } -// isHidden is like IsHidden but takes parsed options and does not -// throw an error. -func (l *Locator) isHidden(opts *FrameIsHiddenOptions) (bool, error) { - opts.Strict = true - return l.frame.isHidden(l.selector, opts) -} - // Fill out the element using locator's selector with strict mode on. func (l *Locator) Fill(value string, opts goja.Value) { l.log.Debugf( diff --git a/tests/locator_test.go b/tests/locator_test.go index a5434939d..1c8cb346e 100644 --- a/tests/locator_test.go +++ b/tests/locator_test.go @@ -344,7 +344,7 @@ func TestLocatorElementState(t *testing.T) { { "hidden", `() => document.getElementById('inputText').style.visibility = 'hidden'`, - func(l *common.Locator) bool { resp, _ := l.IsHidden(nil); return !resp }, + func(l *common.Locator) bool { resp, _ := l.IsHidden(); return !resp }, }, { "readOnly",