browser-use icon indicating copy to clipboard operation
browser-use copied to clipboard

expect the CustomBrowserContext provide new_page() method

Open bolt163 opened this issue 10 months ago • 2 comments

Bug Description

page = await browser_context.new_page() ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'CustomBrowserContext' object has no attribute 'new_page'

Reproduction Steps

browser_context = await browser.new_context( config=BrowserContextConfig( trace_path="./tmp/traces", save_recording_path="./tmp/record_videos", no_viewport=False, browser_window_size=BrowserContextWindowSize( width=window_w, height=window_h ), ) )

    page = await browser_context.new_page()

Code Sample

browser_context = await browser.new_context(
            config=BrowserContextConfig(
                trace_path="./tmp/traces",
                save_recording_path="./tmp/record_videos",
                no_viewport=False,
                browser_window_size=BrowserContextWindowSize(
                    width=window_w, height=window_h
                ),
            )
        )

        page = await browser_context.new_page()

Version

latest version

LLM Model

DeepSeek Coder

Operating System

macos

Relevant Log Output


bolt163 avatar Feb 14 '25 09:02 bolt163

@bolt163 Please note that the Browser class in browser-use is completely different from Playwright’s Browser; they are entirely separate in design and functionality. Likewise, the context used in browser-use is not the same as Playwright’s context, and therefore, the new_page() method does not exist in browser-use. Instead, you might consider using the create_new_tab() method to open a new tab.

https://github.com/browser-use/browser-use/blob/76e4c2630d72c0aa313d1f34c8fb53bed86a0e15/browser_use/browser/context.py#L1067-L1082

create_new_tab() internally calls new_page()

pppp606 avatar Feb 16 '25 15:02 pppp606

thanks

Takuto Yuki @.***> 于2025年2月16日周日 23:12写道:

@bolt163 https://github.com/bolt163 Please note that the Browser class in browser-use is completely different from Playwright’s Browser; they are entirely separate in design and functionality. Likewise, the context used in browser-use is not the same as Playwright’s context, and therefore, the new_page() method does not exist in browser-use. Instead, you might consider using the create_new_tab() method to open a new tab.

https://github.com/browser-use/browser-use/blob/76e4c2630d72c0aa313d1f34c8fb53bed86a0e15/browser_use/browser/context.py#L1067-L1082

create_new_tab() internally calls new_page()

— Reply to this email directly, view it on GitHub https://github.com/browser-use/browser-use/issues/722#issuecomment-2661475198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGABEAY3VBEDD2ZMVYP4EM32QCTE7AVCNFSM6AAAAABXEFAKOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGQ3TKMJZHA . You are receiving this because you were mentioned.Message ID: @.***> [image: pppp606]pppp606 left a comment (browser-use/browser-use#722) https://github.com/browser-use/browser-use/issues/722#issuecomment-2661475198

@bolt163 https://github.com/bolt163 Please note that the Browser class in browser-use is completely different from Playwright’s Browser; they are entirely separate in design and functionality. Likewise, the context used in browser-use is not the same as Playwright’s context, and therefore, the new_page() method does not exist in browser-use. Instead, you might consider using the create_new_tab() method to open a new tab.

https://github.com/browser-use/browser-use/blob/76e4c2630d72c0aa313d1f34c8fb53bed86a0e15/browser_use/browser/context.py#L1067-L1082

create_new_tab() internally calls new_page()

— Reply to this email directly, view it on GitHub https://github.com/browser-use/browser-use/issues/722#issuecomment-2661475198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGABEAY3VBEDD2ZMVYP4EM32QCTE7AVCNFSM6AAAAABXEFAKOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGQ3TKMJZHA . You are receiving this because you were mentioned.Message ID: @.***>

bolt163 avatar Feb 17 '25 01:02 bolt163