pyppeteer_stealth icon indicating copy to clipboard operation
pyppeteer_stealth copied to clipboard

Under the root user of Linux, if I set --no-sandbox, stealth fails

Open JerryChenn07 opened this issue 3 years ago • 1 comments

Under the root user of Linux, if I set --no-sandbox, stealth fails

import asyncio

from pyppeteer import launch
from pyppeteer_stealth import stealth



async def main():
    opt = {'headless': True,'args': ['--no-sandbox']}
    browser = await launch(opt)
    page = await browser.newPage()

    await stealth(page)  # <-- Here

    await page.goto("https://bot.sannysoft.com/")
    print(await page.content())
    await browser.close()


asyncio.run(main())

result: image


But if I modify the source code of pyppeteer, write --no-sandbox directly in the DEFAULT_ARGS of the source code, it will take effect.

import asyncio

from pyppeteer import launch
from pyppeteer_stealth import stealth



async def main():
    browser = await launch(headless=True)
    page = await browser.newPage()

    await stealth(page)  # <-- Here

    await page.goto("https://bot.sannysoft.com/")
    print(await page.content())
    await browser.close()


asyncio.run(main())

image

JerryChenn07 avatar Apr 20 '21 09:04 JerryChenn07

遇到了相同的问题

songge8 avatar Jan 23 '22 16:01 songge8