Skip to content

initial spike on patchright #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/StagehandContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
BrowserContext as PlaywrightContext,
Page as PlaywrightPage,
} from "@playwright/test";
} from "patchright";
import { Stagehand } from "./index";
import { StagehandPage } from "./StagehandPage";
import { Page } from "../types/page";
Expand Down
4 changes: 2 additions & 2 deletions lib/StagehandPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Browserbase } from "@browserbasehq/sdk";
import type { CDPSession, Page as PlaywrightPage } from "@playwright/test";
import { chromium } from "@playwright/test";
import type { CDPSession, Page as PlaywrightPage } from "patchright";
import { chromium } from "patchright";
import { z } from "zod";
import { Page, defaultExtractSchema } from "../types/page";
import {
Expand Down
2 changes: 1 addition & 1 deletion lib/a11y/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AccessibilityNode, TreeResult, AXNode } from "../../types/context";
import { StagehandPage } from "../StagehandPage";
import { LogLine } from "../../types/log";
import { CDPSession, Page, Locator } from "playwright";
import { CDPSession, Page, Locator } from "patchright";
import {
PlaywrightCommandMethodNotSupportedException,
PlaywrightCommandException,
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/actHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator } from "@playwright/test";
import { Locator } from "patchright";
import { LogLine } from "../../types/log";
import {
PlaywrightCommandException,
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/agentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AgentProvider } from "../agent/AgentProvider";
import { StagehandAgent } from "../agent/StagehandAgent";
import { AgentClient } from "../agent/AgentClient";
import { LogLine } from "../../types/log";
import { Page } from "playwright";
import { Page } from "patchright";
import {
AgentExecuteOptions,
AgentAction,
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/handlerUtils/actHandlerUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, Locator } from "@playwright/test";
import { Page, Locator } from "patchright";
import { PlaywrightCommandException } from "../../../types/playwright";
import { StagehandPage } from "../../StagehandPage";
import { getNodeFromXpath } from "@/lib/dom/utils";
Expand Down
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Browserbase } from "@browserbasehq/sdk";
import { Browser, chromium } from "@playwright/test";
import { Browser, chromium } from "patchright";
import dotenv from "dotenv";
import fs from "fs";
import os from "os";
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"example": "pnpm --filter @browserbasehq/stagehand-examples run start",
"example": "pnpm --filter @browserbasehq/stagehand-examples run start",
"format": "prettier --write .",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write .",
Expand Down Expand Up @@ -72,6 +72,7 @@
"@google/genai": "^0.8.0",
"ai": "^4.3.9",
"openai": "^4.87.1",
"patchright": "^1.52.1",
"pino": "^9.6.0",
"pino-pretty": "^13.0.0",
"playwright": "^1.52.0",
Expand Down
21 changes: 21 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"skipLibCheck": true,
"declaration": true
},
"exclude": ["node_modules", "dist", ".eslintrc.cjs"]
"exclude": ["node_modules", "dist", ".eslintrc.cjs", "evals/deterministic/"]
}
2 changes: 1 addition & 1 deletion types/act.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LLMClient } from "../lib/llm/LLMClient";
import { Locator } from "@playwright/test";
import { Locator } from "patchright";
import { Logger } from "@/types/log";
import { StagehandPage } from "@/lib/StagehandPage";

Expand Down
2 changes: 1 addition & 1 deletion types/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BrowserContext as PlaywrightContext } from "@playwright/test";
import type { BrowserContext as PlaywrightContext } from "patchright";
import { Page } from "../types/page";

export interface AXNode {
Expand Down
2 changes: 1 addition & 1 deletion types/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
Browser as PlaywrightBrowser,
BrowserContext as PlaywrightContext,
Page as PlaywrightPage,
} from "@playwright/test";
} from "patchright";
import { z } from "zod";
import type {
ActOptions,
Expand Down
2 changes: 1 addition & 1 deletion types/stagehand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LLMProvider } from "../lib/llm/LLMProvider";
import { LogLine } from "./log";
import { AvailableModel, ClientOptions } from "./model";
import { LLMClient } from "../lib/llm/LLMClient";
import { Cookie } from "@playwright/test";
import { Cookie } from "patchright";
import { AgentProviderType } from "./agent";

export interface ConstructorParams {
Expand Down
Loading