pydoll icon indicating copy to clipboard operation
pydoll copied to clipboard

fix: Get file extension from file path and changes use of reserved word 'format' to 'fmt'

Open ciceroadf opened this issue 8 months ago • 2 comments

I've run the following test code:

import asyncio
from pydoll.browser.chrome import Chrome
from pydoll.constants import By

async def main():
    # Start the browser with no additional webdriver configuration!
    async with Chrome() as browser:
        await browser.start()
        page = await browser.get_page()
        
        # Navigate through captcha-protected sites without worry
        await page.go_to('https://www.example.com')
        await page.get_screenshot('./ss.png')
        

asyncio.run(main())

It saved ss.png in the root directory, as expected, but when i tried to open it with the ubuntu's default image visualizer, i got the following error:

image

When i tried to change it to jpeg, it worked just fine, so i've implemented some logic to get the file extension from the file path given by the developer, i've also changed the use of the reserved word "format" to "fmt" to avoid problems.

ciceroadf avatar Mar 08 '25 16:03 ciceroadf

I've implemented the changes requested

ciceroadf avatar Mar 09 '25 12:03 ciceroadf

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pydoll/browser/page.py 80.00% 1 Missing :warning:
pydoll/exceptions.py 75.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Flag Coverage Δ
tests 97.30% <80.00%> (+1.08%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pydoll/commands/page.py 98.18% <100.00%> (ø)
pydoll/element.py 98.41% <ø> (ø)
pydoll/browser/page.py 95.34% <80.00%> (-0.49%) :arrow_down:
pydoll/exceptions.py 75.00% <75.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Mar 10 '25 12:03 codecov-commenter