Skip to content

[Bug]: After using the Undetected Browser Mode, there is an issue with the on_execution_started callback in the page element selection. The selected element's element.inner_html() returns the entire content of the page. #1418

@yf123s5

Description

@yf123s5

crawl4ai version

0.7.4

Expected Behavior

When using the Undetected Browser Mode and enable_stealth mode, there will be no problem with incorrect selection of elements.

Current Behavior

    browser_config = BrowserConfig(
        headless=False,
        verbose=False,
        enable_stealth=True,
    )
    # adapter = UndetectedAdapter()
    # strategy = AsyncPlaywrightCrawlerStrategy(
    #     browser_config=browser_config, browser_adapter=adapter
    # )
    crawler = AsyncWebCrawler(
        # crawler_strategy=strategy, 
        config=browser_config
    )  

After using the Undetected Browser Mode, there is a problem with the selection of the page element in the callback function. The selected element, element.inner_html(), is the entire content of the page. If I uncomment it, using the combination mode of Undetected Browser Mode and enable_stealth, it appears in the callback function, for example:
on_execution_started,Obtain the page object and then through
rows = await page.query_selector_all(".list .table tbody tr.cur")
if rows:
first_row = rows[0]
print(await first_row.inner_html())
print(await first_row.inner_text())
The printed results are not the content of that element.
However, if I only use "enable_stealth", there won't be any problem.

Is this reproducible?

Yes

Inputs Causing the Bug

Steps to Reproduce

Code snippets

OS

Windows

Python version

3.12

Browser

chrome

Browser version

No response

Error logs & Screenshots (if applicable)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 BugSomething isn't working🩺 Needs TriageNeeds attention of maintainers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions