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

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

Merged
merged 3 commits into from
Mar 10, 2025

Conversation

ciceroadf
Copy link
Contributor

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.

Copy link
Owner

@thalissonvs thalissonvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some renames for more clarity

@thalissonvs thalissonvs added the bug Something isn't working label Mar 8, 2025
@ciceroadf
Copy link
Contributor Author

I've implemented the changes requested

@ciceroadf ciceroadf force-pushed the fix_file_extension branch from 70fb0c9 to 74ee62e Compare March 9, 2025 12:48
Copy link
Owner

@thalissonvs thalissonvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ruff ci is still breaking, just run 'task format' to fix :)
Give a look at the tests too

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2025

⚠️ 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 ⚠️
pydoll/exceptions.py 75.00% 1 Missing ⚠️

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

Flag Coverage Δ
tests 97.30% <80.00%> (+1.08%) ⬆️

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%) ⬇️
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.

@ciceroadf ciceroadf force-pushed the fix_file_extension branch from 7142e8a to abdc33a Compare March 10, 2025 12:38
Copy link
Owner

@thalissonvs thalissonvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for the contribution :)

@thalissonvs thalissonvs merged commit 0cd946d into thalissonvs:main Mar 10, 2025
2 checks passed
@ciceroadf ciceroadf deleted the fix_file_extension branch March 10, 2025 18:31
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

Successfully merging this pull request may close these issues.

3 participants