Skip to content

[Bug]: Some Cheat methods are Broken #154

Description

@TunixR

Browsergym Version

0.5.3 (Workarena)

Playwright Version

1.44.0

Operating System Type

Windows

Operating System Version

Windows 10 22H2 (Build 19045)

Affected Browsers

Chromium

What happened?

  1. Last month, I crafted some scripts to gather ground truth data on Tasks, which worked fine using the cheat() method of simple and compositional tasks
  2. Recently, when executing .cheat() on the same tasks, it fails very rapidly, failing to locate elements with playwright
  3. This change of behavious is inconsistant between tasks. Some fail, others execute fine.

Reproduction Steps

The following script depends on env.reset() setting up the browser correctly. It will sometimes fail, so just re-run.

$ python -c "from browsergym.workarena.tasks.compositional.dash_do_catalog import DashboardRetrieveCatalogAndMaxOrderDevelopmentLaptopPCTask; task_cls = DashboardRetrieveCatalogAndMaxOrderDevelopmentLaptopPCTask; from browsergym.core.env import BrowserEnv;env = BrowserEnv(task_entrypoint=task_cls,headless=False);env.reset();task=env.task;task.cheat(env.page,[],0)"

Relevant Logs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Code\WorkArena\src\browsergym\workarena\tasks\compositional\base.py", line 198, in cheat
    self.subtasks[subtask_idx].cheat(page, chat_messages)
  File "C:\Code\WorkArena\src\browsergym\workarena\tasks\navigation.py", line 104, in cheat
    button.scroll_into_view_if_needed()
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\sync_api\_generated.py", line 16737, in scroll_into_view_if_needed
    self._sync(self._impl_obj.scroll_into_view_if_needed(timeout=timeout))
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_locator.py", line 541, in scroll_into_view_if_needed
    return await self._with_element(
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_locator.py", line 108, in _with_element
    handle = await self.element_handle(timeout=timeout)
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_locator.py", line 311, in element_handle
    handle = await self._frame.wait_for_selector(
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_frame.py", line 323, in wait_for_selector
    await self._channel.send("waitForSelector", locals_to_params(locals()))
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "C:\Code\WorkArena\.venv\lib\site-packages\playwright\_impl\_connection.py", line 514, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Locator.scroll_into_view_if_needed: Timeout 30000ms exceeded.
Call log:
waiting for locator("div[aria-label=\"All menu\"]").get_by_label("Reports", exact=True).and_(locator("div[aria-label=\"All menu\"]").get_by_role("button")).locator("xpath=ancestor::div[contains(@class, 'snf-collapsible-list')]").locator("button[aria-label=\"Administration\"], div[role=\"button\"][aria-label=\"Administration\"]").first

Additional Context

As additional context: I have noticed there are new messages when opening the platform at the top, that spawn a few seconds after the automation begin. I assume that might have something to do with the failures as it is the only change I can notice in the platform.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions