fix(stealth): 修复 launch 选项与测试基线不一致问题
在 stealth 默认策略下保留自定义 user-agent,不再被 CDP 覆盖。 同步更新 protocol/browser/launch/file-access 相关测试预期,并放宽 browser.test 的 hook 超时以消除偶发超时。
This commit is contained in:
+7
-2
@@ -445,7 +445,10 @@ export class BrowserManager {
|
||||
): Promise<void> {
|
||||
const policy = this.getStealthPolicy();
|
||||
if (!policy.applyInitScripts) return;
|
||||
await applyStealthScripts(context, options);
|
||||
await applyStealthScripts(context, {
|
||||
...options,
|
||||
userAgent: this.contextUserAgent,
|
||||
});
|
||||
this.logStealthPolicy('init-script applied');
|
||||
}
|
||||
|
||||
@@ -1693,7 +1696,9 @@ export class BrowserManager {
|
||||
this.cdpEndpoint = null;
|
||||
|
||||
if (stealthPolicy.enabled && browserType === 'chromium') {
|
||||
await applyBrowserLevelStealth(this.browser);
|
||||
await applyBrowserLevelStealth(this.browser, {
|
||||
userAgent: contextUserAgent,
|
||||
});
|
||||
}
|
||||
|
||||
if (!options.userAgent && stealthPolicy.enabled && browserType === 'chromium') {
|
||||
|
||||
Reference in New Issue
Block a user