Fix underlying frame.waitForSelector
#1534
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This fixes an issue with APIs that use the underlying
frame.waitForSelector
. It does this by reusingframe.waitFor
which contains a fix to retry on certain errors which can occur when a navigation is taking place while also waiting for the selector.Why?
This makes several APIs more robust when called during or after a navigation to a new page. I believe the list covers most of the APIs that this fix applies to:
frame.WaitForSelector
locator.IsChecked
locator.DispatchEvent
locator.Fill
locator.Focus
locator.GetAttribute
locator.InnerHTML
locator.InnerText
locator.InputValue
locator.IsEditable
locator.IsEnabled
locator.IsDisabled
locator.Press
locator.SelectOption
frame.SetInputFiles
page.TextContent
locator.Type
locator.Click
locator.Check
locator.SetChecked
locator.Uncheck
locator.DblClick
locator.Hover
locator.Tap
Tests that works with fix (but not without)
Test that used to fail on reading the
textContent
of theh2
header.Test that used to fail when working with
waitForSelector
.Checklist
Related PR(s)/Issue(s)
Related: #1469
Fixes: grafana/k6#4048