mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(inspector): disable highlight during screenshot actions (#18621)
Fixes #18049.
This commit is contained in:
parent
9172a2ca5a
commit
1cee65722b
@ -151,12 +151,16 @@ export class Recorder implements InstrumentationListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await this._context.exposeBinding('__pw_recorderState', false, source => {
|
await this._context.exposeBinding('__pw_recorderState', false, source => {
|
||||||
let actionSelector = this._highlightedSelector;
|
let actionSelector = '';
|
||||||
let actionPoint: Point | undefined;
|
let actionPoint: Point | undefined;
|
||||||
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
const hasActiveScreenshotCommand = [...this._currentCallsMetadata.keys()].some(isScreenshotCommand);
|
||||||
if (source.page === sdkObject.attribution.page) {
|
if (!hasActiveScreenshotCommand) {
|
||||||
actionPoint = metadata.point || actionPoint;
|
actionSelector = this._highlightedSelector;
|
||||||
actionSelector = actionSelector || metadata.params.selector;
|
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
||||||
|
if (source.page === sdkObject.attribution.page) {
|
||||||
|
actionPoint = metadata.point || actionPoint;
|
||||||
|
actionSelector = actionSelector || metadata.params.selector;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const uiState: UIState = {
|
const uiState: UIState = {
|
||||||
@ -235,7 +239,9 @@ export class Recorder implements InstrumentationListener {
|
|||||||
this._currentCallsMetadata.set(metadata, sdkObject);
|
this._currentCallsMetadata.set(metadata, sdkObject);
|
||||||
this._updateUserSources();
|
this._updateUserSources();
|
||||||
this.updateCallLog([metadata]);
|
this.updateCallLog([metadata]);
|
||||||
if (metadata.params && metadata.params.selector) {
|
if (isScreenshotCommand(metadata)) {
|
||||||
|
this.hideHighlightedSelecor();
|
||||||
|
} else if (metadata.params && metadata.params.selector) {
|
||||||
this._highlightedSelector = metadata.params.selector;
|
this._highlightedSelector = metadata.params.selector;
|
||||||
this._recorderApp?.setSelector(this._highlightedSelector).catch(() => {});
|
this._recorderApp?.setSelector(this._highlightedSelector).catch(() => {});
|
||||||
}
|
}
|
||||||
@ -675,3 +681,7 @@ class ThrottledFile {
|
|||||||
this._text = undefined;
|
this._text = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isScreenshotCommand(metadata: CallMetadata) {
|
||||||
|
return metadata.method.includes('screenshot');
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user