-
Notifications
You must be signed in to change notification settings - Fork 33
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
The new version seems to introduce new issues #71
Comments
Could you share your code causing the error? |
@nwebson Here's a representation of the code: from browserforge.headers import Browser, HeaderGenerator
from rebrowser_playwright.sync_api import sync_playwright
DEFAULT_STEALTH_FLAGS = ['--no-pings', '--incognito', '--test-type', '--lang=en-US', '--mute-audio', '--no-first-run', '--disable-sync', '--hide-scrollbars', '--disable-logging', '--start-maximized', '--enable-async-dns', '--disable-breakpad', '--disable-infobars', '--accept-lang=en-US', '--use-mock-keychain', '--disable-translate', '--disable-extensions', '--disable-voice-input', '--window-position=0,0', '--disable-wake-on-wifi', '--ignore-gpu-blocklist', '--enable-tcp-fast-open', '--enable-web-bluetooth', '--disable-hang-monitor', '--password-store=basic', '--disable-cloud-import', '--disable-default-apps', '--disable-print-preview', '--disable-dev-shm-usage', '--metrics-recording-only', '--disable-crash-reporter', '--disable-partial-raster', '--disable-gesture-typing', '--disable-checker-imaging', '--disable-prompt-on-repost', '--force-color-profile=srgb', '--font-render-hinting=none', '--no-default-browser-check', '--aggressive-cache-discard', '--disable-component-update', '--disable-cookie-encryption', '--disable-domain-reliability', '--disable-threaded-animation', '--disable-threaded-scrolling', '--enable-simple-cache-backend', '--disable-background-networking', '--disable-session-crashed-bubble', '--enable-surface-synchronization', '--disable-image-animation-resync', '--disable-renderer-backgrounding', '--disable-ipc-flooding-protection', '--prerender-from-omnibox=disabled', '--safebrowsing-disable-auto-update', '--disable-offer-upload-credit-cards', '--disable-features=site-per-process', '--disable-background-timer-throttling', '--disable-new-content-rendering-timeout', '--run-all-compositor-stages-before-draw', '--disable-client-side-phishing-detection', '--disable-backgrounding-occluded-windows', '--disable-layer-tree-host-memory-pressure', '--autoplay-policy=no-user-gesture-required', '--disable-offer-store-unmasked-wallet-cards', '--disable-blink-features=AutomationControlled', '--webrtc-ip-handling-policy=disable_non_proxied_udp', '--disable-component-extensions-with-background-pages', '--force-webrtc-ip-handling-policy=disable_non_proxied_udp', '--enable-features=NetworkService,NetworkServiceInProcess,TrustTokens,TrustTokensAlwaysAllowIssuance', '--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4', '--disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process,TranslateUI,BlinkGenPropertyTrees']
def generate_headers():
return HeaderGenerator(
browser=[Browser(name='chrome', min_version=130)],
os='macos',
device='desktop'
).generate()
with sync_playwright() as p:
browser = p.chromium.launch(
headless=False, args=DEFAULT_STEALTH_FLAGS, ignore_default_args=['--enable-automation', '--disable-popup-blocking'], chromium_sandbox=True, channel='chromium'
)
context = browser.new_context(
locale='en-US',
is_mobile=False,
has_touch=False,
proxy=None,
color_scheme='dark', # Bypasses the 'prefersLightColor' check in creepjs
user_agent=generate_headers().get('User-Agent'),
device_scale_factor=2,
service_workers="allow",
ignore_https_errors=True,
extra_http_headers={},
screen={"width": 1920, "height": 1080},
viewport={"width": 1920, "height": 1080},
permissions=["geolocation", 'notifications'],
)
page = context.new_page()
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/webdriver_fully.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/window_chrome.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/navigator_plugins.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/pdf_viewer.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/notification_permission.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/screen_props.js')
page.add_init_script(path='/Users/karim/Desktop/Scrapling/scrapling/engines/toolbelt/bypasses/playwright_fingerprint.js')
page.set_default_navigation_timeout(30000)
page.set_default_timeout(30000)
res = page.goto('https://antcpt.com/eng/information/demo-form/recaptcha-3-test-score.html', referer=None)
page.wait_for_load_state(state="domcontentloaded")
html = page.content()
page.close() The scripts are from the While creating this code for you I discovered that the issue is caused by Tested the same code without |
Are those scripts really needed? It seems duplicate code to what rebrowser is already doing |
@vlrevolution That is Not true, these scripts add a lot that current patches are not doing but still, if anyone uses |
I see and yeah of course, it was off beat, the root issue remains |
Hey @nwebson @vlrevolution any updates on this? |
Thanks for reporting this bug, just fixed it in the new release: |
Thanks @nwebson I have just tested it as well |
After updating, the library always crashing on
page.goto
method with this error:I'm using MacOS and the latest Playwright browsers, have you read the changes to Chrome headless in Playwright 1.49? I think it's related.
microsoft/playwright#33566
The text was updated successfully, but these errors were encountered: