Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion browsergym/miniwob/src/browsergym/miniwob/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@ def setup(self, page: playwright.sync_api.Page) -> tuple[str, dict]:

# navigate to the task's url
self.page.goto(self.url)

# Apply zoom using CSS transform scale instead of document.documentElement.style.zoom
# This avoids coordinate system mismatches with getBoundingClientRect() in whoCapturesCenterClick()
self.page.evaluate(
"""
document.body.style.transform = 'scale(1.5)';
document.body.style.transformOrigin = 'top left';
document.body.style.width = '66.67%';
document.body.style.height = '66.67%';
"""
)
# remove human display if requested (goal, time left, last reward etc.)
if self.remove_human_display:
self.page.evaluate( # if error : core is not defined, make sure you started the miniwob http server at the right place miniwob-plusplus/miniwob/html
Expand Down