Skip to content

Commit 2a1e71b

Browse files
committed
Update agenticScraper.js
1 parent af63d00 commit 2a1e71b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scrapegraph-js/src/agenticScraper.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,19 @@ export async function agenticScraper(apiKey, url, steps, useSession = true, user
182182
* allowing for complex interactions like form filling, clicking buttons,
183183
* and navigating through multi-step workflows with session management.
184184
*/
185-
export async function getAgenticScraperRequest(apiKey, requestId) {
185+
export async function getAgenticScraperRequest(apiKey, requestId, options = {}) {
186+
const { mock = null } = options;
187+
188+
// Check if mock mode is enabled
189+
const useMock = mock !== null ? mock : isMockEnabled();
190+
191+
if (useMock) {
192+
console.log('🧪 Mock mode active. Returning stub for getAgenticScraperRequest');
193+
const mockConfig = getMockConfig();
194+
const mockData = getMockResponse('GET', `https://api.scrapegraphai.com/v1/agentic-scrapper/${requestId}`, mockConfig.customResponses, mockConfig.customHandler);
195+
return mockData;
196+
}
197+
186198
const endpoint = 'https://api.scrapegraphai.com/v1/agentic-scrapper/' + requestId;
187199
const headers = {
188200
'accept': 'application/json',

0 commit comments

Comments
 (0)