Skip to content

[rebrowser-playwright-python] await page.title() does not work #77

Closed
@KrAsH-CoD3

Description

@KrAsH-CoD3

For some reason i am unable to get the page title using rebrowser-playwright-python but playwright works fine. Both libraries have same version 1.49.1

Expected: Page title to be gotten

Reality: Stuck on the await page.title()

Code;

# from playwright.async_api import (
from rebrowser_playwright.async_api import (
    BrowserContext, Page, Browser, async_playwright
)
import asyncio

async def get_page_title(url):
    async with async_playwright() as playwright:
        browser: Browser = await playwright.chromium.launch(headless=False)
        
        device_settings = {
            "user_agent": "Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.28 Mobile Safari/537.36",
            "viewport": {"width": 450, "height": 580},
            "screen": {"width": 450, "height": 580 + 150},
            "device_scale_factor": 1,
            "is_mobile": True,
            "has_touch": True,
        }
        
        context: BrowserContext = await browser.new_context(
            **device_settings
        )
        page: Page = await context.new_page()
        
        await page.goto(url)
        
        title = await page.title()
        print(f"Page Title: {title}")
        
        await page.close()
        await context.close()
        await browser.close()
    
url = 'https://www.google.com'
asyncio.run(get_page_title(url))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions