@@ -22,105 +22,49 @@ npm install @auto-browse/auto-browse
22
22
23
23
## ⚠️ Important: Playwright Version Requirements
24
24
25
- > ** Note: ** Auto Browse currently requires specific versions of Playwright. This requirement will be relaxed in future versions .
25
+ Auto Browse requires Playwright version 1.53.0 or higher .
26
26
27
27
### Required Versions
28
28
29
29
``` bash
30
- " @playwright/test" : " 1.52.0-alpha-1743011787000 "
31
- " playwright" : " 1.52.0-alpha-1743011787000 "
30
+ " @playwright/test" : " >=1.53.0 "
31
+ " playwright" : " >=1.53.0 "
32
32
```
33
33
34
- ### Version Conflicts
34
+ ### Installation
35
35
36
- If you're using Auto Browse alongside an existing Playwright setup, you must upgrade to these specific versions. Here's how to handle common issues :
36
+ If you encounter version conflicts, use the legacy peer deps flag :
37
37
38
- 1 . ** Installation Conflicts**
39
-
40
- ``` bash
41
- npm install --legacy-peer-deps
42
- ```
43
-
44
- This flag helps resolve peer dependency conflicts during installation.
45
-
46
- 2 . ** Multiple Playwright Versions**
47
-
48
- - Remove existing Playwright installations
49
- - Clear npm cache if needed: ` npm cache clean --force `
50
- - Reinstall with the required versions
51
-
52
- 3 . ** Project Compatibility**
53
- - Update your project's Playwright configuration
54
- - Ensure your existing tests are compatible with the alpha version
55
- - Consider using a separate test environment if needed
56
-
57
- > 🔄 Future releases will support a wider range of Playwright versions. Subscribe to our GitHub repository for updates.
38
+ ``` bash
39
+ npm install --legacy-peer-deps
40
+ ```
58
41
59
- ## Configuration
42
+ ## Quick Setup
60
43
61
- Auto Browse requires environment variables for the LLM (Language Model) configuration . Create a ` .env ` file in your project root:
44
+ 1 . Create a ` .env ` file in your project root:
62
45
63
46
``` env
64
- # OpenAI (default)
47
+ # For OpenAI (default)
65
48
OPENAI_API_KEY=your_openai_api_key_here
66
- LLM_PROVIDER=openai # Optional, defaults to openai
67
- AUTOBROWSE_LLM_MODEL=gpt-4o-mini # Optional, defaults to gpt-4o-mini
49
+ LLM_PROVIDER=openai # Optional
50
+ AUTOBROWSE_LLM_MODEL=gpt-4o-mini # Optional
68
51
69
- # Google AI
52
+ # Or for Google AI
70
53
GOOGLE_API_KEY=your_google_key_here
71
54
LLM_PROVIDER=google
72
55
AUTOBROWSE_LLM_MODEL=gemini-2.0-flash-lite
73
-
74
- # Azure OpenAI
75
- AZURE_OPENAI_API_KEY=your_azure_key_here
76
- AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
77
- AZURE_OPENAI_API_VERSION=2024-12-01-preview
78
- AZURE_OPENAI_API_DEPLOYMENT_NAME=your-deployment-name
79
- LLM_PROVIDER=azure
80
-
81
- # Anthropic
82
- ANTHROPIC_API_KEY=your_anthropic_key_here
83
- LLM_PROVIDER=anthropic
84
- AUTOBROWSE_LLM_MODEL=claude-3
85
-
86
- # Google Vertex AI
87
- GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
88
- LLM_PROVIDER=vertex
89
-
90
- # Ollama
91
- BASE_URL=http://localhost:11434 # Optional, defaults to this value
92
- LLM_PROVIDER=ollama
93
- AUTOBROWSE_LLM_MODEL=llama3.1
94
56
```
95
57
96
- You can find an example configuration in ` example.env ` .
97
-
98
- ### Environment Variables
99
-
100
- | Variable | Description | Default | Required For |
101
- | ---------------------------------- | -------------------------------------- | ------------------------ | ------------ |
102
- | ` LLM_PROVIDER ` | LLM provider to use | ` openai ` | No |
103
- | ` AUTOBROWSE_LLM_MODEL ` | The LLM model to use | ` gpt-4o-mini ` | No |
104
- | ` OPENAI_API_KEY ` | OpenAI API key | - | OpenAI |
105
- | ` GOOGLE_API_KEY ` | Google AI API key | - | Google AI |
106
- | ` AZURE_OPENAI_API_KEY ` | Azure OpenAI API key | - | Azure |
107
- | ` AZURE_OPENAI_ENDPOINT ` | Azure OpenAI endpoint URL | - | Azure |
108
- | ` AZURE_OPENAI_API_VERSION ` | Azure OpenAI API version | ` 2024-12-01-preview ` | Azure |
109
- | ` AZURE_OPENAI_API_DEPLOYMENT_NAME ` | Azure OpenAI deployment name | - | Azure |
110
- | ` ANTHROPIC_API_KEY ` | Anthropic API key | - | Anthropic |
111
- | ` GOOGLE_APPLICATION_CREDENTIALS ` | Path to Google Vertex credentials file | - | Vertex AI |
112
- | ` BASE_URL ` | Ollama API endpoint | ` http://localhost:11434 ` | No |
58
+ 2 . Start automating!
113
59
114
60
## Supported LLM Providers
115
61
116
- Auto Browse supports multiple LLM providers:
117
-
118
- - OpenAI (default) - GPT-4 and compatible models
119
- - Google AI - Gemini models
120
- - Azure OpenAI - GPT models on Azure
121
- - Anthropic - Claude models
122
- - Google Vertex AI - PaLM and Gemini models
123
- - Ollama - Run models locally
62
+ - ** OpenAI** (default) - GPT-4 and compatible models
63
+ - ** Google AI** - Gemini models
64
+ - ** Azure OpenAI** - GPT models on Azure
65
+ - ** Anthropic** - Claude models
66
+ - ** Google Vertex AI** - PaLM and Gemini models
67
+ - ** Ollama** - Run models locally
124
68
125
69
## Usage
126
70
@@ -211,125 +155,65 @@ test("simplified example", async ({ page }) => {
211
155
212
156
### BDD Mode with Playwright-BDD
213
157
214
- Auto Browse seamlessly integrates with [ playwright-bdd] ( https://github.com/vitalets/playwright-bdd ) for behavior-driven development. This allows you to write expressive feature files and implement steps using natural language commands.
215
-
216
- #### Example Feature File
158
+ Auto Browse integrates with [ playwright-bdd] ( https://github.com/vitalets/playwright-bdd ) for behavior-driven development:
217
159
218
160
``` gherkin
219
161
# features/homepage.feature
220
162
Feature: Playwright Home Page
221
-
222
163
Scenario: Check title
223
164
Given navigate to https://playwright.dev
224
165
When click link "Get started"
225
166
Then assert title "Installation"
226
167
```
227
168
228
- #### Step Definitions
229
-
230
169
``` typescript
170
+ // One step definition handles all actions
231
171
import { auto } from " @auto-browse/auto-browse" ;
232
172
import { Given , When as aistep , Then } from " ./fixtures" ;
233
173
234
- // Generic step that handles any natural language action
235
174
aistep (/ ^ (. * )$ / , async ({ page }, action : string ) => {
236
175
await auto (action , { page });
237
176
});
238
177
```
239
178
240
- #### Setup Requirements
241
-
242
- 1 . Install dependencies:
243
-
244
- ``` bash
245
- npm install --save-dev @playwright/test @cucumber/cucumber playwright-bdd
246
- ```
247
-
248
- 2 . Configure ` playwright.config.ts ` :
179
+ ### Key Actions
249
180
250
181
``` typescript
251
- import { PlaywrightTestConfig } from " @playwright/test" ;
252
-
253
- const config: PlaywrightTestConfig = {
254
- testDir: " ./features" ,
255
- use: {
256
- baseURL: " https://playwright.dev"
257
- }
258
- };
259
-
260
- export default config ;
261
- ```
262
-
263
- This integration enables:
264
-
265
- - Natural language test scenarios
266
- - Reusable step definitions
267
- - Cucumber reporter integration
268
- - Built-in Playwright context management
269
-
270
- ### Supported Actions
182
+ // Navigation
183
+ await auto (" go to https://example.com" );
271
184
272
- 1 . ** Clicking Elements**
185
+ // Clicking
186
+ await auto (" click the submit button" );
273
187
274
- ``` typescript
275
- await auto (" click the submit button" );
276
- await auto (" click the link that says Learn More" );
277
- ```
188
+ // Typing
189
+ await auto (' type "username" in the email field' );
278
190
279
- 2 . ** Typing Text**
191
+ // Verification
192
+ await auto (" verify the success message is visible" );
280
193
281
- ``` typescript
282
- await auto (' type "username" in the email field' );
283
- await auto (' enter "password123" in the password input' );
284
- ```
285
-
286
- ## Features
194
+ // Taking snapshots
195
+ await auto (" take a snapshot" );
196
+ ```
287
197
288
- Core Features:
198
+ ## Core Features
289
199
290
- - Natural language commands for browser automation
291
- - AI-powered computer and browser agent
292
- - Automate any browser task
293
- - Automatic page/context detection
294
- - TypeScript support
295
- - Playwright test integration
296
- - Zero configuration required
200
+ - ** Natural Language Commands ** - Write automation in plain English
201
+ - ** AI-Powered Intelligence ** - Smart element detection and interaction
202
+ - ** Auto Context Detection ** - Automatically manages browser and page contexts
203
+ - ** Multiple LLM Support ** - Works with OpenAI, Google AI, Anthropic, and more
204
+ - ** Playwright Integration ** - Seamless integration with Playwright tests
205
+ - ** TypeScript Support ** - Full type safety and IntelliSense
206
+ - ** Zero Configuration ** - Works out of the box with minimal setup
297
207
298
- Supported Operations:
208
+ ## Documentation
299
209
300
- - Page Navigation (goto URL, back, forward)
301
- - Element Interactions (click, type, hover, drag-and-drop)
302
- - Form Handling (select options, file uploads, form submission)
303
- - Visual Verification (snapshots, screenshots, PDF export)
304
- - Keyboard Control (key press, text input)
305
- - Wait and Timing Control
306
- - Assertions and Validation
210
+ 📚 [ Full Documentation] ( https://typescript.docs.auto-browse.com/quickstart ) - Complete guides, examples, and API reference
307
211
308
212
## Best Practices
309
213
310
- 1 . ** Be Descriptive**
311
-
312
- ``` typescript
313
- // Good
314
- await auto (" click the submit button in the login form" );
315
-
316
- // Less Clear
317
- await auto (" click submit" );
318
- ```
319
-
320
- 2 . ** Use Quotes for Input Values**
321
-
322
- ``` typescript
323
- // Good
324
- await auto (' type "John Doe" in the name field' );
325
-
326
- // Not Recommended
327
- await auto (" type John Doe in the name field" );
328
- ```
329
-
330
- 3 . ** Leverage Existing Labels**
331
- - Use actual labels and text from your UI in commands
332
- - Maintain good accessibility practices in your app for better automation
214
+ - ** Be descriptive** : ` "click the submit button in the login form" ` vs ` "click submit" `
215
+ - ** Use quotes for values** : ` 'type "John Doe" in the name field' `
216
+ - ** Take snapshots** : ` "take a snapshot" ` helps the AI understand page context
333
217
334
218
## Contributing
335
219
0 commit comments