Skip to content

Commit 08b0c87

Browse files
committed
removed screenshot capabilities for now.
1 parent 0a339cb commit 08b0c87

File tree

5 files changed

+5
-125
lines changed

5 files changed

+5
-125
lines changed

BROWSER_AUTOMATION.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ This document describes the browser automation capabilities implemented in the p
88

99
- Browser session management
1010
- Page control and interaction
11-
- Screenshot capture
1211
- Resource cleanup and management
1312
- Error handling
1413
- Type-safe API
@@ -30,12 +29,6 @@ Manages page interactions:
3029
- State management
3130
- Event handling
3231

33-
### ScreenshotManager
34-
Provides screenshot capabilities:
35-
- Full page captures
36-
- Element-specific captures
37-
- Screenshot storage and management
38-
3932
## Installation & Setup
4033

4134
```bash
@@ -69,14 +62,6 @@ await page.click('#submit-button');
6962
await page.type('#search-input', 'search term');
7063
```
7164

72-
### Taking Screenshots
73-
```typescript
74-
await page.screenshot({
75-
path: './screenshot.png',
76-
fullPage: true
77-
});
78-
```
79-
8065
## Error Handling
8166

8267
The system implements comprehensive error handling:
@@ -117,7 +102,6 @@ Main class providing browser automation capabilities.
117102
#### Methods
118103
- `newPage()`: Creates a new page session
119104
- `close()`: Closes all browser sessions
120-
- `screenshot()`: Captures screenshots
121105
- `evaluate()`: Evaluates JavaScript in the page context
122106

123107
### PageController
@@ -129,13 +113,6 @@ Handles page-specific operations.
129113
- `type(selector: string, text: string)`: Types text
130114
- `waitForSelector(selector: string)`: Waits for element
131115

132-
### ScreenshotManager
133-
Manages screenshot operations.
134-
135-
#### Methods
136-
- `capture(options: ScreenshotOptions)`: Takes screenshot
137-
- `saveToFile(path: string)`: Saves screenshot to file
138-
139116
## Future Enhancements
140117

141118
The following features are planned for future releases:
@@ -193,4 +170,4 @@ Please see CONTRIBUTING.md for guidelines on contributing to this project.
193170

194171
## License
195172

196-
This project is licensed under the MIT License - see the LICENSE file for details.
173+
This project is licensed under the MIT License - see the LICENSE file for details

src/tools/browser/BrowserAutomation.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { BrowserManager } from "./browser-manager.js";
22
import { PageController } from "./page-controller.js";
3-
import { ScreenshotController } from "./screenshot.js";
43

54
export class BrowserAutomation {
65
private static instance: BrowserAutomation;
@@ -20,12 +19,10 @@ export class BrowserAutomation {
2019
async createSession(headless: boolean = false) {
2120
const session = await this.browserManager.createSession({ headless });
2221
const pageController = new PageController(session.page);
23-
const screenshotManager = new ScreenshotController(session.page);
2422

2523
return {
2624
sessionId: session.id,
2725
pageController,
28-
screenshotManager,
2926
close: () => this.browserManager.closeSession(session.id),
3027
};
3128
}

src/tools/browser/browseMessage.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
import { Tool } from '../../core/types.js';
22
import { z } from 'zod';
33
import { zodToJsonSchema } from 'zod-to-json-schema';
4-
import { browserSessions, type BrowserAction, SelectorType, type ScreenshotOptions } from './types.js';
5-
6-
// Schema for browser action options
7-
const screenshotOptionsSchema = z.object({
8-
path: z.string().optional(),
9-
fullPage: z.boolean().optional(),
10-
type: z.enum(['png', 'jpeg']).optional(),
11-
quality: z.number().min(0).max(100).optional(),
12-
}).optional();
4+
import { browserSessions, type BrowserAction, SelectorType } from './types.js';
135

146
// Schema for browser action
157
const browserActionSchema = z.object({
16-
type: z.enum(['goto', 'click', 'type', 'wait', 'screenshot', 'content', 'close']),
8+
type: z.enum(['goto', 'click', 'type', 'wait', 'content', 'close']),
179
url: z.string().url().optional(),
1810
selector: z.string().optional(),
1911
selectorType: z.nativeEnum(SelectorType).optional(),
2012
text: z.string().optional(),
21-
options: screenshotOptionsSchema,
13+
options: z.object({}).optional(),
2214
}).describe('Browser action to perform');
2315

2416
// Main parameter schema
@@ -32,7 +24,6 @@ const parameterSchema = z.object({
3224
const returnSchema = z.object({
3325
status: z.string(),
3426
content: z.string().optional(),
35-
screenshot: z.string().optional(),
3627
error: z.string().optional(),
3728
});
3829

@@ -110,16 +101,6 @@ export const browseMessageTool: Tool<Parameters, ReturnType> = {
110101
return { status: 'success' };
111102
}
112103

113-
case 'screenshot': {
114-
const screenshotBuffer = await page.screenshot({
115-
...action.options,
116-
type: 'png',
117-
});
118-
const screenshotBase64 = screenshotBuffer.toString('base64');
119-
logger.verbose('Screenshot captured successfully');
120-
return { status: 'success', screenshot: screenshotBase64 };
121-
}
122-
123104
case 'content': {
124105
const content = await page.content();
125106
logger.verbose('Page content retrieved successfully');

src/tools/browser/screenshot.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/tools/browser/types.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export enum BrowserErrorCode {
2323
UNKNOWN = "UNKNOWN",
2424
SELECTOR_INVALID = "SELECTOR_INVALID",
2525
ELEMENT_NOT_FOUND = "ELEMENT_NOT_FOUND",
26-
SCREENSHOT_FAILED = "SCREENSHOT_FAILED",
2726
}
2827

2928
// Browser error class
@@ -54,15 +53,6 @@ export interface SelectorOptions {
5453
visible?: boolean;
5554
}
5655

57-
// Screenshot options
58-
export interface ScreenshotOptions {
59-
path?: string;
60-
fullPage?: boolean;
61-
type?: "png" | "jpeg";
62-
quality?: number;
63-
scale?: number;
64-
}
65-
6656
// Global map to store browser sessions
6757
export const browserSessions: Map<string, BrowserSession> = new Map();
6858

@@ -77,6 +67,5 @@ export type BrowserAction =
7767
selectorType?: SelectorType;
7868
}
7969
| { type: "wait"; selector: string; selectorType?: SelectorType }
80-
| { type: "screenshot"; options?: ScreenshotOptions }
8170
| { type: "content" }
82-
| { type: "close" };
71+
| { type: "close" };

0 commit comments

Comments
 (0)