Debug Steel automation issues and provide solutions
Debugs Steel automation issues and provides specific code fixes for common errors.
/plugin marketplace add nibzard/steel-marketplace/plugin install steel-forge@steel-marketplaceHelp the user debug Steel automation issues using live sessions and error analysis.
sessionViewerUrl to see what's happeningIf user has Steel CLI (@steel-dev/cli), suggest:
steel config - Verify API key and configurationsteel run <template> --view - Run working example to comparesteel browser start --verbose - Start local browser with detailed logsInstall if needed: npm install -g @steel-dev/cli
Symptoms: Session creation timed out or similar errors
Solution:
const session = await client.sessions.create({
sessionTimeout: 60000, // Increase timeout to 60s
});
Symptoms: TimeoutError: waiting for selector failed
Solution:
// Wait for page to fully load
await page.waitForLoadState('networkidle');
// Try multiple selectors
const selectors = [
'[data-testid="submit"]',
'#submit-button',
'button:has-text("Submit")'
];
for (const selector of selectors) {
try {
await page.waitForSelector(selector, { timeout: 5000 });
break;
} catch (e) {
continue;
}
}
Symptoms: WebSocket connection failed or CDP connection error
Check:
// Ensure API key is passed correctly
const wsUrl = `${session.websocketUrl}?apiKey=${process.env.STEEL_API_KEY}`;
const browser = await chromium.connectOverCDP(wsUrl);
Symptoms: Running out of concurrent sessions
Solution:
// Always use try-finally
const session = await client.sessions.create();
try {
// Your automation code
} finally {
await client.sessions.release(session.id);
}
Symptoms: Timeouts during page navigation
Solution:
const session = await client.sessions.create({
blockAds: true, // Block ads for faster loading
dimensions: { width: 1280, height: 800 }
});
await page.goto(url, {
waitUntil: 'domcontentloaded' // Don't wait for everything
});
Symptoms: Automation stops at CAPTCHA pages
Solution:
const session = await client.sessions.create({
solveCaptcha: true, // Enable CAPTCHA solving
useProxy: true // Use residential proxies
});
Symptoms: Elements exist but selector fails
Solution:
// Wait for iframe
const frameElement = await page.waitForSelector('iframe');
const frame = await frameElement.contentFrame();
// Search inside iframe
await frame.waitForSelector('[data-testid="target"]');
Symptoms: Elements appear later but selector times out
Solution:
// Wait for network to be idle
await page.waitForLoadState('networkidle');
// Or wait for specific element
await page.waitForSelector('[data-testid="loaded-content"]', {
state: 'visible',
timeout: 15000
});
When user reports an issue:
Get context:
Use live session:
const session = await client.sessions.create();
console.log('Debug at:', session.sessionViewerUrl);
// User can watch what's happening in real-time
Add debugging output:
console.log('Step 1: Creating session');
const session = await client.sessions.create();
console.log('Session ID:', session.id);
console.log('Step 2: Connecting browser');
const browser = await chromium.connectOverCDP(/*...*/);
console.log('Step 3: Navigating to page');
await page.goto(url);
console.log('Current URL:', page.url());
Test selectors:
// Check if element exists
const element = await page.$('[data-testid="target"]');
if (element) {
console.log('Element found!');
} else {
console.log('Element not found, trying alternatives...');
}
Provide working solution with explanation
If issues persist, suggest checking:
Always focus on practical, immediate solutions over theoretical debugging approaches.