import asyncio import random import names from playwright.async_api import ProxySettings, TimeoutError as PlaywrightTimeoutError, Error, Page, async_playwright, Response, BrowserContext, Browser as PlaywrightBrowser from playwright_stealth import stealth_async class Browser: def __init__(self): self.context = None self.color_schemes = ['light', 'dark', 'no-preference'] self.locations = ['de-DE', 'fr-FR', 'es-ES', 'it-IT', ' ja-JP', 'en-AU', 'zh-CN', 'pt-BR', 'ar-AE', 'hi-IN', 'en-CA', 'en-NZ', 'pt-BR'] async def create_page(self, link: str): page = await self.context.new_page() await page.emulate_media(color_scheme=random.choice(self.color_schemes)) await stealth_async(page) await page.goto(link) return self.context, page async def create(self): playwright = await async_playwright().start() browser = await playwright.chromium.launch(proxy={"server": "","username": "","password": "" }) devices = playwright.devices device = random.choice(list(devices.values())) self.context = await browser.new_context( locale='ua-UA', ) return browser async def main(mail: str): driver = Browser() browser = await driver.create() context, page = await driver.create_page(link='https://vrlps.co/st76vhv/cp') locator = page.frame_locator('.vl-frame') element = locator.nth(0) data = element.get_by_placeholder("Your First Name*") await data.fill(names.get_first_name()) locator = page.frame_locator('.vl-frame') element = locator.nth(0) data = element.get_by_placeholder("Your Last Name") await data.fill(names.get_last_name()) locator = page.frame_locator('.vl-frame') element = locator.nth(0) data = element.get_by_placeholder("Your Email Address*") await data.fill(mail) locator = page.frame_locator('.vl-frame') element = locator.nth(0) data = element.get_by_role('button') sign_up = data.nth(0) await sign_up.click() await asyncio.sleep(2) await browser.close() async def start(): with open('mails.txt', 'r') as fp: data = fp.readlines() for el in data: mail = el.split(':')[0].strip() await main(mail) if __name__ == '__main__': asyncio.run(start())