Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1.0的版本好像都不能创建无痕窗口或是隐私窗口, #469

Open
maryjeck opened this issue Dec 18, 2024 · 2 comments
Open

Comments

@maryjeck
Copy link

new_tab(new_context=True) 好像不行,同样的浏览器,4.0.5.6的可以,
在比特浏览器,gologin,vmlogin都不行,普通浏览器也不行,

@maryjeck
Copy link
Author

@g1879 大佬,能看看么?
不行只能换回到4.0.5.6了

@maryjeck
Copy link
Author

maryjeck commented Jan 4, 2025

好像找到了问题,4.1的版本对Incognito判断有误,只要浏览器打开过无痕窗口,就会被认为是无痕模式,states.is_incognito这个一定显示为True。可以用以下代码打开强制打开无痕窗口:
`
browserContextId = browser._run_cdp("Target.createBrowserContext")["browserContextId"]

kwargs = {"url": "", "browserContextId": browserContextId}

tabId = browser._run_cdp("Target.createTarget", **kwargs)['targetId']

tab = browser.get_tab(id_or_num=tabId)
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant