mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
33 lines
747 B
Python
33 lines
747 B
Python
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
import asyncio
|
|
|
|
from langchain_openai import ChatOpenAI
|
|
|
|
from browser_use import Agent
|
|
|
|
"""
|
|
Example: Using the 'Scroll down' action.
|
|
|
|
This script demonstrates how the agent can navigate to a webpage and scroll down the content.
|
|
If no amount is specified, the agent will scroll down by one page height.
|
|
"""
|
|
|
|
llm = ChatOpenAI(model='gpt-4o')
|
|
|
|
agent = Agent(
|
|
task="Navigate to 'https://en.wikipedia.org/wiki/Internet' and scroll down by one page - then scroll up by 100 pixels - then scroll down by 100 pixels - then scroll down by 10000 pixels.",
|
|
llm=llm,
|
|
)
|
|
|
|
|
|
async def main():
|
|
await agent.run()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|