from playwright.sync_api import sync_playwright base = 'https://joyhub-website-frontend-test.best-envision.com' countries = [ 'Kenya', 'Côte d’ivoire', 'South Korea', 'Great Britain (United Kingdom; England)', 'Vatican City (The Holy See)', 'Singapore', 'Sweden', 'Poland', 'Netherlands', 'Japan', 'Italy', 'Spain', 'Germany', 'Canada', 'Australia', 'France', ] with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page(viewport={'width': 1920, 'height': 1080}) for country in countries: try: page.goto(base + '/points-redemption', wait_until='domcontentloaded') page.wait_for_timeout(1500) page.locator('header .relative.inline-block').nth(5).click(force=True) page.wait_for_timeout(500) page.get_by_text(country, exact=True).first.click(force=True, timeout=5000) page.wait_for_timeout(2500) body = page.locator('body').inner_text() print(country, '| url=', page.url, '| redeem=', 'Redeem' in body, '| unsupported=', 'currently do not support delivery' in body, '| sample=', body[:300].replace('\n', ' | ')) except Exception as exc: print(country, '| ERROR=', type(exc).__name__, str(exc)[:200]) browser.close()