MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / setup

Method setup

webarena/browser_env/async_envs.py:47–71  ·  view source on GitHub ↗
(self, config_file: Path | None = None)

Source from the content-addressed store, hash-verified

45 self.viewport_size = viewport_size
46
47 async def setup(self, config_file: Path | None = None) -> None:
48 self.context_manager = async_playwright()
49 self.playwright = await self.context_manager.__aenter__()
50 self.browser = await self.playwright.chromium.launch(
51 headless=self.headless, slow_mo=self.slow_mo
52 )
53 if config_file:
54 with open(config_file, "r") as f:
55 instance_config = json.load(f)
56 else:
57 instance_config = {}
58
59 storage_state = instance_config.get("storage_state", None)
60 start_url = instance_config.get("start_url", None)
61 geolocation = instance_config.get("geolocation", None)
62
63 self.context = await self.browser.new_context(
64 viewport=self.viewport_size,
65 storage_state=storage_state,
66 geolocation=geolocation,
67 device_scale_factor=1,
68 )
69 self.page = await self.context.new_page()
70 if start_url:
71 await self.page.goto(start_url)
72
73 async def areset(
74 self,

Callers 1

aresetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected