Skip to content
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

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

Open
KrAsH-CoD3 opened this issue Dec 26, 2024 · 0 comments
Open

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

KrAsH-CoD3 opened this issue Dec 26, 2024 · 0 comments

Comments

@KrAsH-CoD3
Copy link

KrAsH-CoD3 commented Dec 26, 2024

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant