Spaces:
Sleeping
Sleeping
| """Fill the V-test form end-to-end without the LLM, to validate browser.py.""" | |
| import asyncio | |
| import pathlib | |
| import sys | |
| sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) | |
| from vtest_agent.browser import VTestBrowser | |
| async def main() -> None: | |
| b = VTestBrowser() | |
| try: | |
| print(await b.open_form()) | |
| print("---") | |
| for field, value in [ | |
| ("postal_code", "9000"), | |
| ("property_type", "domicile"), | |
| ("electricity", "yes"), | |
| ("gas", "yes"), | |
| ("consumption", "unknown"), | |
| ("digital_meter", "yes"), | |
| ("meter_counting", "single"), | |
| ("residents", "3"), | |
| ("heat_pump", "no"), | |
| ("electric_car", "no"), | |
| ("solar_panels", "no"), | |
| ("home_battery", "no"), | |
| ]: | |
| print(await b.set_field(field, value)) | |
| print("---") | |
| print(await b.get_form_state()) | |
| print("--- submitting ---") | |
| print(await b.submit_and_get_results()) | |
| page = await b._ensure_page() | |
| pathlib.Path("/tmp/vtest_results.html").write_text(await page.content()) | |
| print("results HTML saved to /tmp/vtest_results.html, url:", page.url) | |
| finally: | |
| await b.close() | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |