When I try to load a website that uses cloudflare protection while using playwright and browserforge, I get stuck “Verifying you are human…” loop. Any idea how to bypass this?
from playwright.sync_api import sync_playwright
import time
import random
from browserforge.injectors.playwright import NewContext
from browserforge.fingerprints import FingerprintGenerator,Screen
def main():
with sync_playwright() as p:
browser = p.firefox.launch(headless=False)
screen = Screen(
min_width=100,
max_width=1280,
min_height=400,
max_height=720
)
fingerprints = FingerprintGenerator(screen=screen,http_version=2)
fingerprint = fingerprints.generate(browser='firefox')
context = NewContext(browser,viewport={ 'width': 900, 'height': 900 },fingerprint=fingerprint)
page = context.new_page()
url = "https://bscscan.com/contractsVerified"
page.goto(url,wait_until="domcontentloaded")
while True:
time.sleep(100)
browser.close()
if __name__ == '__main__':
main()