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

Inconsistent Exception Formatting When page.goto() Times Out #167

Open
matecsaj opened this issue Jan 28, 2025 · 0 comments
Open

Inconsistent Exception Formatting When page.goto() Times Out #167

matecsaj opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@matecsaj
Copy link

Describe the bug:

Most exceptions raised by Camoufox have an 'e' value that is a concise string without line breaks. However, I've noticed that when page.goto() times out, the formatting of the e value is different. I'm not sure if this is a bug or if it's intended behavior.

Screenshots:

/Users/matecsaj/PycharmProjects/wat-crawlee/venv/bin/python /Users/matecsaj/Library/Application Support/JetBrains/PyCharm2024.3/scratches/scratch_1.py 
ERROR:root:Starting test
ERROR:root:Failed to load slow page: Page.goto: Timeout 0.001ms exceeded.
Call log:
  - navigating to "http://httpstat.us/200?sleep=5000", waiting until "load"

ERROR:root:Ending test

Process finished with exit code 0

To Reproduce:

import asyncio
import logging
from camoufox.async_api import AsyncCamoufox

async def test_slow_page():
    logging.basicConfig(level=logging.ERROR)
    logging.error("Starting test")
    try:
        async with AsyncCamoufox() as browser:
            page = await browser.new_page()
            # Intentionally tiny timeout for a slow-loading page
            await page.goto("http://httpstat.us/200?sleep=5000", timeout=0.001)
    except Exception as e:
        logging.error(f"Failed to load slow page: {e}")
    logging.error("Ending test")

asyncio.run(test_slow_page())

Version:

Pip package:    v0.4.9
Camoufox:       v133.0-beta.19 (Latest supported: v134.0.2-beta.20)
@matecsaj matecsaj added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant