Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Add boilerplate code to protects users from accidentally invoking the script

Morris Lee4484cf022d11
diff --git a/examples/ui/command_line.py b/examples/ui/command_line.py
index 9f9bc0ab9..188e19866 100644
--- a/examples/ui/command_line.py
+++ b/examples/ui/command_line.py
@@ -70,5 +70,5 @@ async def main():
input('Press Enter to close the browser...')
await browser.close()
-
-asyncio.run(main())
+if __name__ == "__main__":
+ asyncio.run(main())
\ No newline at end of file