[🐛 Bug]: call devtools.target.create_browser_context() failed
What happened?
call devtools.target.create_browser_context() return error
selenium.webdriver.common.bidi.cdp.BrowserError: BrowserError<code=-32000 message=Not allowed> None
Python 3.8.9
How can we reproduce the issue?
from selenium import webdriver
import selenium.webdriver.common.devtools.v101 as devtools
async def create_context(driver):
async with driver.bidi_connection() as session:
cdp_session = session.session
a = await cdp_session.execute(
devtools.target.create_browser_context()
)
print(a)
async def main():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(options=chrome_options)
try:
driver.get("https://my-location.org/")
await create_context(driver)
# or driver.execute_cdp_cmd('Target.createBrowserContext', {})
finally:
driver.quit()
if __name__ == '__main__':
import trio
trio.run(main)
Relevant log output
Traceback (most recent call last):
File "/Users/ant/work/selenium4/test_context.py", line 29, in <module>
trio.run(main)
File "/Users/ant/work/selenium4/venv/lib/python3.8/site-packages/trio/_core/_run.py", line 1946, in run
raise runner.main_task_outcome.error
File "/Users/ant/work/selenium4/test_context.py", line 21, in main
await create_context(driver)
File "/Users/ant/work/selenium4/test_context.py", line 8, in create_context
a = await cdp_session.execute(
File "/Users/ant/work/selenium4/venv/lib/python3.8/site-packages/selenium/webdriver/common/bidi/cdp.py", line 203, in execute
raise response
selenium.webdriver.common.bidi.cdp.BrowserError: BrowserError<code=-32000 message=Not allowed> None
Operating System
macOS Monterey
Selenium version
Python Selenium 4.1.5
What are the browser(s) and version(s) where you see this issue?
Chrome 102.0.5005.61
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 102.0.5005.61
Are you using Selenium Grid?
No response
@ant1dot, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
@ant1dot could you try this with devtools 102 in selenium==4.2.0 ?
updated to 4.2.0 but getting the same error
This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.
issue is actual, current error
selenium.webdriver.common.bidi.cdp.BrowserError: BrowserError<code=-32000 message=Not allowed> None
chromedriver fixed this bug https://bugs.chromium.org/p/chromedriver/issues/detail?id=4533
Thanks for letting us know, @ant1dot!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.