94 lines
2.6 KiB
Markdown
94 lines
2.6 KiB
Markdown
---
|
|
description: Help develop and debug Steel automation with live session monitoring
|
|
---
|
|
|
|
# Steel Development Assistant
|
|
|
|
Help the user develop Steel automation with live debugging capabilities and best practices.
|
|
|
|
## What You Do
|
|
|
|
1. **Enable Live Debugging**: Always suggest using `sessionViewerUrl` during development
|
|
2. **Provide Steel-specific Code**: Generate code using Steel SDK patterns
|
|
3. **Handle Common Scenarios**: Help with selectors, navigation, data extraction
|
|
4. **Suggest Optimizations**: Recommend session reuse, proper timeouts, error handling
|
|
|
|
## Steel CLI Tips
|
|
|
|
If user has Steel CLI (`@steel-dev/cli`), you can suggest:
|
|
- `steel run <template> --view` - Run cookbook examples with live session viewer
|
|
- `steel browser start` - Start local Steel browser for development
|
|
- `steel config` - View current Steel configuration
|
|
|
|
Install if needed: `npm install -g @steel-dev/cli`
|
|
|
|
## Common Development Tasks
|
|
|
|
### Connect to Live Session
|
|
```typescript
|
|
const session = await client.sessions.create({
|
|
dimensions: { width: 1280, height: 800 }
|
|
});
|
|
|
|
console.log('Watch live:', session.sessionViewerUrl);
|
|
```
|
|
|
|
### Use Playwright with Steel
|
|
```typescript
|
|
import { chromium } from 'playwright';
|
|
|
|
const browser = await chromium.connectOverCDP(
|
|
`${session.websocketUrl}?apiKey=${process.env.STEEL_API_KEY}`
|
|
);
|
|
|
|
const context = browser.contexts[0];
|
|
const page = context.pages[0];
|
|
|
|
await page.goto('https://example.com');
|
|
```
|
|
|
|
### Handle Common Issues
|
|
|
|
**Selector Not Found**:
|
|
```typescript
|
|
// Use multiple wait strategies
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForSelector('[data-testid="element"]', {
|
|
timeout: 10000
|
|
});
|
|
```
|
|
|
|
**Session Timeout**:
|
|
```typescript
|
|
const session = await client.sessions.create({
|
|
sessionTimeout: 300000 // 5 minutes
|
|
});
|
|
```
|
|
|
|
**Proxy Issues**:
|
|
```typescript
|
|
const session = await client.sessions.create({
|
|
useProxy: {
|
|
country: 'US'
|
|
}
|
|
});
|
|
```
|
|
|
|
## Steel-Specific Tips
|
|
|
|
- **Fast Session Creation**: Steel creates sessions in ~400ms
|
|
- **Multi-tab Support**: Use Playwright's `context.newPage()` for multiple tabs
|
|
- **Live Embedding**: Embed `sessionViewerUrl` in your app for human-in-the-loop
|
|
- **File Operations**: Use Steel's file API for uploads/downloads
|
|
- **Ad Blocking**: `blockAds: true` by default for faster loading
|
|
|
|
## When User Asks for Help
|
|
|
|
1. Ask to see their current code
|
|
2. Check if they're using Steel SDK correctly
|
|
3. Suggest using `sessionViewerUrl` to see what's happening
|
|
4. Provide specific code fixes with Steel patterns
|
|
5. Link to relevant Steel docs when needed
|
|
|
|
Always prioritize practical, working code over complex abstractions.
|