Skip to content

Commit

Permalink
fix(navigator): wait for 3000ms if the action triggers a navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
idiotWu committed Apr 25, 2024
1 parent 3eeca15 commit 674da0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion npi/browser_app/navigator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
from textwrap import dedent
from typing import Union, List, Literal, Tuple
from playwright.async_api import Error

from typing_extensions import NotRequired, TypedDict

Expand Down Expand Up @@ -328,6 +329,10 @@ async def _run_action(self, thread: Thread, action: Action) -> Tuple[Union[str,
if elem:
await elem.dispose()

await self.wait_for_stable()
try:
await self.wait_for_stable()
except Error:
# FIXME: if the action triggers a navigator, we will receive an error showing "Page.evaluate: Execution context was destroyed, most likely because of a navigation"
await self.playwright.page.wait_for_timeout(3000)

return result, elem_json

0 comments on commit 674da0c

Please sign in to comment.