Skip to content

Commit c876a74

Browse files
committed
Add pressSequentially tracing
1 parent 20e9642 commit c876a74

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

internal/js/modules/k6/browser/common/locator.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,22 @@ func (l *Locator) Press(key string, opts *FramePressOptions) error {
536536
// keypress, and keyup events for each character in the provided string.
537537
// For handling special keys, use the [Locator.Press] method.
538538
func (l *Locator) PressSequentially(text string, opts *FrameTypeOptions) error {
539+
l.log.Debugf(
540+
"Locator:PressSequentially", "fid:%s furl:%q sel:%q text:%q opts:%+v",
541+
l.frame.ID(), l.frame.URL(), l.selector, text, opts,
542+
)
543+
_, span := TraceAPICall(l.ctx, l.frame.page.targetID.String(), "locator.pressSequentially")
544+
defer span.End()
545+
539546
if err := l.Type(text, opts); err != nil {
540-
return fmt.Errorf("pressing sequentially %q on %q: %w", text, l.selector, err)
547+
err := fmt.Errorf("pressing sequentially %q on %q: %w", text, l.selector, err)
548+
spanRecordError(span, err)
549+
return err
541550
}
551+
552+
// slowMo is already applied in Type method.
553+
// So we don't need to apply it again here.
554+
542555
return nil
543556
}
544557

0 commit comments

Comments
 (0)