Skip to content

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

Fix parameter in twitter example

magmuellerd35f4b821c8a
diff --git a/examples/twitter_post_using_cookies.py b/examples/twitter_post_using_cookies.py
index f19890c9c..dc2ad1bcd 100644
--- a/examples/twitter_post_using_cookies.py
+++ b/examples/twitter_post_using_cookies.py
@@ -5,7 +5,6 @@ from dotenv import load_dotenv
from langchain_google_genai import ChatGoogleGenerativeAI
from pydantic import SecretStr
-from browser_use import Agent
from browser_use import Agent
from browser_use.browser.browser import Browser, BrowserConfig
from browser_use.browser.context import BrowserContext, BrowserContextConfig
@@ -25,26 +24,19 @@ browser = Browser(
)
)
-context = BrowserContext(
- browser = browser,
- config = BrowserContextConfig(cookies_file= "twitter_cookies.txt")
-)
-
-
+context = BrowserContext(browser=browser, config=BrowserContextConfig(cookies_file='twitter_cookies.txt'))
async def run_search():
agent = Agent(
browser_context=context,
- task=(
- 'go to https://x.com. write a new post with the text "browser-use ftw", and submit it'
- ),
+ task=('go to https://x.com. write a new post with the text "browser-use ftw", and submit it'),
llm=llm,
max_actions_per_step=4,
- tool_call_in_content=False
)
await agent.run(max_steps=25)
input('Press Enter to close the browser...')
+
if __name__ == '__main__':
asyncio.run(run_search())