fix(desktop): keep element selectors available on loaded pages (#3187)

* fix(desktop): keep element selectors available on loaded pages

Annotate element and Screenshot element returned early when a cached load signal said the guest was not ready, even if the current document was complete and executable. Let executeJavaScript own the readiness boundary and keep selector cleanup available in the same stale-signal state.

Extend the real Electron browser regression to reproduce the complete-document/stale-signal mismatch through both toolbar actions.

* test(desktop): await browser selector injection

Poll the guest selector state through the browser bridge instead of assuming injection completes within 250 ms. This keeps the Electron regression deterministic on slower CI hosts.

* Harden browser selector session lifecycle

* Keep selector E2E fixtures independent

* fix(desktop): harden selector and annotation lifecycle

* fix(desktop): keep selector PR focused

* refactor(desktop): own element selector lifecycle

---------

Co-authored-by: Daniel G. Kang <180234654+dgk-dev@users.noreply.github.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
Daniel G. Kang
2026-08-14 15:51:42 +08:00
committed by GitHub
co-authored by Daniel G. Kang Mohamed Boudra
parent b03dc804eb
commit 770b87a15c
14 changed files with 649 additions and 362 deletions
+2
View File
@@ -523,6 +523,8 @@ export const ar: TranslationResources = {
screenshotCopied: "تم نسخ لقطة الشاشة إلى الحافظة",
elementCopied: "تم نسخ العنصر إلى الحافظة",
screenshotFailed: "تعذّر نسخ لقطة الشاشة",
selectorLoading: "انتظر حتى ينتهي تحميل الصفحة",
selectorFailed: "تعذّر بدء محدد العنصر",
},
annotate: {
title: "التعليق على العنصر",
+2
View File
@@ -522,6 +522,8 @@ export const en = {
screenshotCopied: "Copied screenshot to clipboard",
elementCopied: "Copied element to clipboard",
screenshotFailed: "Couldn't copy screenshot",
selectorLoading: "Wait for the page to finish loading",
selectorFailed: "Couldn't start element selector",
},
annotate: {
title: "Annotate element",
+2
View File
@@ -527,6 +527,8 @@ export const es: TranslationResources = {
screenshotCopied: "Captura copiada al portapapeles",
elementCopied: "Elemento copiado al portapapeles",
screenshotFailed: "No se pudo copiar la captura",
selectorLoading: "Espera a que la página termine de cargar",
selectorFailed: "No se pudo iniciar el selector de elementos",
},
annotate: {
title: "Anotar elemento",
+2
View File
@@ -527,6 +527,8 @@ export const fr: TranslationResources = {
screenshotCopied: "Capture d'écran copiée dans le presse-papiers",
elementCopied: "Élément copié dans le presse-papiers",
screenshotFailed: "Impossible de copier la capture",
selectorLoading: "Attendez la fin du chargement de la page",
selectorFailed: "Impossible de démarrer le sélecteur d’élément",
},
annotate: {
title: "Annoter l'élément",
+2
View File
@@ -527,6 +527,8 @@ export const ja: TranslationResources = {
screenshotCopied: "スクリーンショットをクリップボードにコピーしました",
elementCopied: "要素をクリップボードにコピーしました",
screenshotFailed: "スクリーンショットをコピーできませんでした",
selectorLoading: "ページの読み込みが完了するまでお待ちください",
selectorFailed: "要素セレクターを開始できませんでした",
},
annotate: {
title: "要素に注釈を付ける",
+2
View File
@@ -524,6 +524,8 @@ export const ko: TranslationResources = {
screenshotCopied: "스크린샷을 클립보드에 복사했습니다.",
elementCopied: "요소를 클립보드에 복사했습니다.",
screenshotFailed: "스크린샷을 복사할 수 없습니다.",
selectorLoading: "페이지 로딩이 끝날 때까지 기다려 주세요.",
selectorFailed: "요소 선택기를 시작할 수 없습니다.",
},
annotate: {
title: "요소에 주석 달기",
+2
View File
@@ -527,6 +527,8 @@ export const ptBR: TranslationResources = {
screenshotCopied: "Captura copiada para a área de transferência",
elementCopied: "Elemento copiado para a área de transferência",
screenshotFailed: "Não foi possível copiar a captura",
selectorLoading: "Aguarde o carregamento da página terminar",
selectorFailed: "Não foi possível iniciar o seletor de elemento",
},
annotate: {
title: "Anotar elemento",
+2
View File
@@ -527,6 +527,8 @@ export const ru: TranslationResources = {
screenshotCopied: "Снимок скопирован в буфер обмена",
elementCopied: "Элемент скопирован в буфер обмена",
screenshotFailed: "Не удалось скопировать снимок",
selectorLoading: "Дождитесь окончания загрузки страницы",
selectorFailed: "Не удалось запустить выбор элемента",
},
annotate: {
title: "Аннотировать элемент",
+2
View File
@@ -523,6 +523,8 @@ export const zhCN: TranslationResources = {
screenshotCopied: "已将截图复制到剪贴板",
elementCopied: "已将元素复制到剪贴板",
screenshotFailed: "无法复制截图",
selectorLoading: "请等待页面加载完成",
selectorFailed: "无法启动元素选择器",
},
annotate: {
title: "标注元素",