Skip to content

stagehandvsrequestium

MIT 183 14 22,012
2.8 million (month) Oct 29 2024 3.2.1(2026-04-10 21:10:37 ago)
1,837 4 8 BSD-3-Clause
Dec 28 2012 79.9 thousand (month) 0.5.1(2026-01-19 16:59:35 ago)

Stagehand is an AI-powered browser automation framework for JavaScript and TypeScript, built by Browserbase. It provides a simple API for controlling browsers using natural language instructions, powered by large language models.

Stagehand offers three core primitives:

  • act() Performs actions on the page described in natural language. For example, page.act("click the login button") will find and click the appropriate element.
  • extract() Extracts structured data from the page based on a natural language description and an optional schema definition.
  • observe() Analyzes the current page state and returns actionable elements and their descriptions, useful for understanding what actions are available on a page.

Key features include:

  • TypeScript-first Built with full TypeScript support and type-safe extraction using Zod schemas.
  • Multiple LLM providers Works with OpenAI, Anthropic, and other LLM providers for powering the AI.
  • Vision and DOM analysis Combines visual screenshot analysis with DOM inspection for robust element identification.
  • Playwright integration Uses Playwright as the browser automation backend, giving access to the full Playwright API alongside AI-powered actions.
  • Browserbase cloud Optionally integrates with Browserbase cloud for managed browser infrastructure.

Stagehand is particularly suited for automating complex web workflows where traditional selectors would be fragile, such as interacting with frequently changing UIs or scraping sites with dynamic layouts.

Requestium is a Python library that merges the power of Requests, Selenium, and Parsel into a single integrated tool for automatizing web actions.

The library was created for writing web automation scripts that are written using mostly Requests but that are able to seamlessly switch to Selenium for the JavaScript heavy parts of the website, while maintaining the session.

Requestium adds independent improvements to both Requests and Selenium, and every new feature is lazily evaluated, so its useful even if writing scripts that use only Requests or Selenium.

Highlights


ai-powerednatural-languagetypescript

Example Use


```javascript import { Stagehand } from '@browserbasehq/stagehand'; import { z } from 'zod'; const stagehand = new Stagehand({ env: 'LOCAL', // or 'BROWSERBASE' for cloud browsers modelName: 'gpt-4o', }); await stagehand.init(); const page = stagehand.page; // Navigate to a page await page.goto('https://news.ycombinator.com'); // Use natural language to interact await page.act('click on the "new" link in the navigation'); // Extract structured data with a schema const stories = await page.extract({ instruction: 'Extract the top 5 story titles and their point counts', schema: z.object({ stories: z.array(z.object({ title: z.string(), points: z.number(), })), }), }); console.log(stories); // Observe available actions on the page const actions = await page.observe('What actions can I take on this page?'); console.log(actions); await stagehand.close(); ```
```python from requestium import Session, Keys session = Session(webdriver_path='./chromedriver', browser='chrome-headless', default_timeout=15) # then session object can be used like requests and parsel: title = session.get('http://samplesite.com').xpath('//title/text()').extract_first(default='Default Title') # other advance functions like POST requests and proxy settings are also available: s.post('http://www.samplesite.com/sample', data={'field1': 'data1'}) s.proxies.update({'http': 'http://10.11.4.254:3128', 'https': 'https://10.11.4.252:3128'}) # session can also be used like selenium as it exposes all selenium functions. # like typing keys: s.driver.find_element_by_xpath("//input[@class='user_name']").send_keys('James Bond', Keys.ENTER) ```

Alternatives / Similar


Was this page helpful?