Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
},
"main": "index.js",
"scripts": {
"build": "tsc && node --experimental-strip-types scripts/post-build.ts",
"build": "tsc && node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/post-build.ts",
"typecheck": "tsc --noEmit",
"format": "eslint --cache --fix . && prettier --write --cache .",
"check-format": "eslint --cache . && prettier --check --cache .;",
"docs": "npm run build && npm run docs:generate && npm run format",
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
"start": "npm run build && node build/src/index.js",
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
"test": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
"test:only": "npm run build && node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:only:no-build": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
"test": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
"test:only": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:only:no-build": "node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
"prepare": "node --experimental-strip-types scripts/prepare.ts"
},
"files": [
Expand Down
5 changes: 5 additions & 0 deletions src/McpContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ export class McpContext implements Context {
page.setDefaultNavigationTimeout(NAVIGATION_TIMEOUT * networkMultiplier);
}

getNavigationTimeout() {
const page = this.getSelectedPage();
return page.getDefaultNavigationTimeout();
}

async getElementByUid(uid: string): Promise<ElementHandle<Element>> {
if (!this.#textSnapshot?.idToNode.size) {
throw new Error('No snapshot found. Use browser_snapshot to capture one');
Expand Down
3 changes: 3 additions & 0 deletions src/McpResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export class McpResponse implements Response {
if (networkConditions) {
response.push(`## Network emulation`);
response.push(`Emulating: ${networkConditions}`);
response.push(
`Navigation timeout set to ${context.getNavigationTimeout()}`,
);
}

const cpuThrottlingRate = context.getCpuThrottlingRate();
Expand Down
3 changes: 2 additions & 1 deletion tests/McpResponse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ uid=1_0 RootWebArea "My test page"
result[0].text,
`# test response
## Network emulation
Emulating: Slow 3G`,
Emulating: Slow 3G
Navigation timeout set to 100000`,
);
});
});
Expand Down
Loading