selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: call devtools.target.create_browser_context() failed

Open ant1dot opened this issue 3 years ago • 3 comments

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 avatar May 27 '22 12:05 ant1dot

@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!

github-actions[bot] avatar May 27 '22 12:05 github-actions[bot]

@ant1dot could you try this with devtools 102 in selenium==4.2.0 ?

symonk avatar May 27 '22 21:05 symonk

updated to 4.2.0 but getting the same error

ant1dot avatar May 30 '22 06:05 ant1dot

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.

github-actions[bot] avatar Mar 06 '23 20:03 github-actions[bot]

issue is actual, current error selenium.webdriver.common.bidi.cdp.BrowserError: BrowserError<code=-32000 message=Not allowed> None

ant1dot avatar Mar 10 '23 07:03 ant1dot

chromedriver fixed this bug https://bugs.chromium.org/p/chromedriver/issues/detail?id=4533

ant1dot avatar Aug 28 '23 14:08 ant1dot

Thanks for letting us know, @ant1dot!

diemol avatar Oct 16 '23 13:10 diemol

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.

github-actions[bot] avatar Dec 03 '23 00:12 github-actions[bot]