Skip to content

Commit 49a6ee7

Browse files
aldro61claude
andcommitted
Update instance filename to instances_v2.json
Switch to the new versioned instance pool file that will be used to enforce package upgrades and manage instance access. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 90559f8 commit 49a6ee7

4 files changed

Lines changed: 104 additions & 2 deletions

File tree

src/browsergym/workarena/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Hugging Face dataset containing available instances
1515
INSTANCE_REPO_ID = "ServiceNow/WorkArena-Instances"
16-
INSTANCE_REPO_FILENAME = "instances.json"
16+
INSTANCE_REPO_FILENAME = "instances_v2.json"
1717
INSTANCE_REPO_TYPE = "dataset"
1818
INSTANCE_XOR_SEED = "x3!+-9mi#nhlo%a02$9hna{]"
1919

src/browsergym/workarena/tasks/form.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,30 @@ def get_init_scripts(self) -> List[str]:
371371
372372
runInGsftMainOnlyAndProtectByURL(monitorChangeOnFields, '{url_suffix}');
373373
""",
374+
f"""
375+
function removePersonalizeFormButton() {{
376+
waLog('Searching for Personalize Form button...', 'removePersonalizeFormButton');
377+
let button = document.querySelector('#togglePersonalizeForm');
378+
if (button) {{
379+
button.remove();
380+
waLog('Removed Personalize Form button', 'removePersonalizeFormButton');
381+
}}
382+
}}
383+
384+
runInGsftMainOnlyAndProtectByURL(removePersonalizeFormButton, '{url_suffix}');
385+
""",
386+
f"""
387+
function removeAdditionalActionsButton() {{
388+
waLog('Searching for Additional Actions button...', 'removeAdditionalActionsButton');
389+
let button = document.querySelector('button.additional-actions-context-menu-button');
390+
if (button) {{
391+
button.remove();
392+
waLog('Removed Additional Actions button', 'removeAdditionalActionsButton');
393+
}}
394+
}}
395+
396+
runInGsftMainOnlyAndProtectByURL(removeAdditionalActionsButton, '{url_suffix}');
397+
""",
374398
]
375399

376400
def start(self, page: Page) -> None:

src/browsergym/workarena/tasks/list.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,28 @@ def all_configs(cls) -> List[dict]:
113113
return json.load(f)
114114

115115
def get_init_scripts(self) -> List[str]:
116-
return super().get_init_scripts() + ["registerGsftMainLoaded();"]
116+
return super().get_init_scripts() + [
117+
"registerGsftMainLoaded();",
118+
self._get_remove_personalize_list_button_script(),
119+
]
120+
121+
def _get_remove_personalize_list_button_script(self):
122+
"""
123+
Removes the 'Personalize List' button on list pages.
124+
"""
125+
script = """
126+
function removePersonalizeListButton() {
127+
waLog('Searching for Personalize List buttons...', 'removePersonalizeListButton');
128+
let buttons = document.querySelectorAll('i[data-type="list_mechanic2_open"]');
129+
buttons.forEach((button) => {
130+
button.remove();
131+
});
132+
waLog('Removed ' + buttons.length + ' Personalize List buttons', 'removePersonalizeListButton');
133+
}
134+
135+
runInGsftMainOnlyAndProtectByURL(removePersonalizeListButton, '_list.do');
136+
"""
137+
return script
117138

118139
def _get_visible_list(self, page: Page):
119140
self._wait_for_ready(page)

src/browsergym/workarena/tasks/service_catalog.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ def get_init_scripts(self) -> List[str]:
225225
"registerGsftMainLoaded()",
226226
self._get_disable_add_to_cart_script(),
227227
self._get_remove_top_items_panel_script(),
228+
self._get_remove_add_content_button_script(),
229+
self._get_remove_header_decorations_script(),
230+
self._get_remove_more_options_buttons_script(),
228231
]
229232

230233
def _get_disable_add_to_cart_script(self):
@@ -276,6 +279,60 @@ def _get_remove_top_items_panel_script(self):
276279
"""
277280
return script
278281

282+
def _get_remove_add_content_button_script(self):
283+
"""
284+
Removes the 'Add content' button from the service catalog page.
285+
"""
286+
script = """
287+
function removeAddContentButton() {
288+
waLog('Searching for Add content button...', 'removeAddContentButton');
289+
let button = document.querySelector('button[aria-label="Add content"]');
290+
if (button) {
291+
button.remove();
292+
waLog('Removed Add content button', 'removeAddContentButton');
293+
}
294+
}
295+
296+
runInGsftMainOnlyAndProtectByURL(removeAddContentButton, 'catalog_home');
297+
"""
298+
return script
299+
300+
def _get_remove_header_decorations_script(self):
301+
"""
302+
Removes all header decoration panels (edit/settings/close buttons) from the service catalog page.
303+
"""
304+
script = """
305+
function removeHeaderDecorations() {
306+
waLog('Searching for header decoration panels...', 'removeHeaderDecorations');
307+
let panels = document.querySelectorAll('div.header_decorations');
308+
panels.forEach((panel) => {
309+
panel.remove();
310+
});
311+
waLog('Removed ' + panels.length + ' header decoration panels', 'removeHeaderDecorations');
312+
}
313+
314+
runInGsftMainOnlyAndProtectByURL(removeHeaderDecorations, 'catalog_home');
315+
"""
316+
return script
317+
318+
def _get_remove_more_options_buttons_script(self):
319+
"""
320+
Removes all 'More Options' buttons from the service catalog page.
321+
"""
322+
script = """
323+
function removeMoreOptionsButtons() {
324+
waLog('Searching for More Options buttons...', 'removeMoreOptionsButtons');
325+
let buttons = document.querySelectorAll('button.btn.btn-icon.icon-ellipsis');
326+
buttons.forEach((button) => {
327+
button.remove();
328+
});
329+
waLog('Removed ' + buttons.length + ' More Options buttons', 'removeMoreOptionsButtons');
330+
}
331+
332+
runInGsftMainOnlyAndProtectByURL(removeMoreOptionsButtons, 'com.glideapp.servicecatalog');
333+
"""
334+
return script
335+
279336
def setup_goal(self, page: Page) -> tuple[str, dict]:
280337
super().setup_goal(page=page)
281338

0 commit comments

Comments
 (0)