diff --git a/extension/src/background.ts b/extension/src/background.ts index 4cc5f70..59a2748 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -1100,7 +1100,7 @@ interface StartRecordingParams { async function handleStartRecording(params: StartRecordingParams): Promise<{ success: true; tabId: number; startedAt: number } | { success: false; error: string }> { const tabId = resolveTabIdFromSessionId(params.sessionId) if (!tabId) { - return { success: false, error: 'No connected tab found for recording' } + return { success: false, error: 'No connected tab found for recording. Click the Playwriter extension icon on the tab you want to record.' } } if (activeRecordings.has(tabId)) { @@ -1125,7 +1125,7 @@ async function handleStartRecording(params: StartRecordingParams): Promise<{ suc const errorMsg = chrome.runtime.lastError.message || 'Unknown error' // Chrome returns this error when activeTab permission hasn't been granted if (errorMsg.includes('Extension has not been invoked') || errorMsg.includes('activeTab')) { - reject(new Error(`${errorMsg}. Toggle the Playwriter extension icon on this tab to enable recording, then try again.`)) + reject(new Error(`${errorMsg}. Click the Playwriter extension icon on this tab to enable recording, then try again.`)) } else { reject(new Error(errorMsg)) } diff --git a/playwriter/src/executor.ts b/playwriter/src/executor.ts index 999bb6e..45f4249 100644 --- a/playwriter/src/executor.ts +++ b/playwriter/src/executor.ts @@ -601,6 +601,9 @@ export class PlaywrightExecutor { audio?: boolean outputPath: string }) => { + // Recording uses chrome.tabCapture which requires activeTab permission. + // This permission is granted when the user clicks the Playwriter extension icon on a tab. + // Recording will work on any tab where the user has clicked the icon. return startRecording({ page: options.page || page, relayPort, diff --git a/playwriter/src/skill.md b/playwriter/src/skill.md index 7ab8dd4..e8670c5 100644 --- a/playwriter/src/skill.md +++ b/playwriter/src/skill.md @@ -423,7 +423,7 @@ Labels are color-coded: yellow=links, orange=buttons, coral=inputs, pink=checkbo **startRecording / stopRecording** - record the page as a video at native FPS (30-60fps). Uses `chrome.tabCapture` in the extension context, so **recording survives page navigation**. Video is saved as WebM. -**Important**: Recording requires the user to have clicked the playwriter extension icon on the target tab first. This grants the `activeTab` permission which is required for `chrome.tabCapture`. If recording fails with "Extension has not been invoked for the current page", ask the user to click the extension icon on the tab they want to record. +**Note**: Recording requires the user to have clicked the Playwriter extension icon on the tab. This grants `activeTab` permission needed for `chrome.tabCapture`. Recording works on tabs where the icon was clicked - if you need to record a new tab, ask the user to click the icon on it first. ```js // Start recording - outputPath must be specified upfront