-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simply does not work #4
Comments
which version of packages? Version: Last: Like this: playwright_sync = sync_playwright().start() executablePath = 'C:\Google\Chrome\Application\chrome.exe' page.set_viewport_size({"width": 1920, "height": 969}) |
Turns out that website (https://bot.sannysoft.com/) does show all tests passing using Chromium with my OS browser and with the playwright executable. But http://whatsmyuseragent.org/ fails with both. |
Hi, I also thought that it does not work, so I found this issue. from playwright.sync_api import sync_playwright
from playwright_stealth import stealth_sync
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context(
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
)
page = context.new_page()
stealth_sync(page)
page.goto("https://bot.sannysoft.com/", wait_until="networkidle", timeout=10000)
page.screenshot(path="screenshot.png")
browser.close() |
Same Issue here.
async with async_playwright() as p:
# launch the browser
browser = await p.chromium.launch()
context = await browser.new_context(
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
)
# stealth.min.js is a js script to prevent the website from detecting the crawler.
await context.add_init_script(path="stealth.min.js") |
I ran both the synced and async versions of your basic user-agent example with Chromium (using the latest version of playwright-python, and the standard pip version of your package) and the screenshot in both cases shows a user agent containing "HeadlessChrome". Obviously, this is not as advertised - the user agent has not been edited.
The text was updated successfully, but these errors were encountered: