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: support multiple default Chrome paths on each OS #47

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dannysigalovich
Copy link

  • Update _get_default_binary_location to check both "Program Files" and "Program Files (x86)" directories.
  • Ensure that Chrome is correctly located regardless of its installation path.
  • Raise an error if Chrome is not found in the default locations.

- Update _get_default_binary_location to check both "Program Files" and "Program Files (x86)" directories.
- Ensure that Chrome is correctly located regardless of its installation path.
- Raise an error if Chrome is not found in the default locations.
@dannysigalovich dannysigalovich changed the title Enhance Chrome binary detection for Windows fix(chrome): update binary detection to support both Program Files and Program Files (x86) Mar 11, 2025
@dannysigalovich dannysigalovich changed the title fix(chrome): update binary detection to support both Program Files and Program Files (x86) fix(chrome): update binary detection to support both Program Files and Program Files (x86) for Windows Mar 11, 2025
@thalissonvs
Copy link
Owner

Hi @dannysigalovich, first of all, thanks for your contribution! I'll review your PR now

@thalissonvs
Copy link
Owner

Also, please follow the Conventional Commits style; without it, I can't generate the releases. Just undo your commit and commit again with the fix: prefix

@thalissonvs thalissonvs linked an issue Mar 11, 2025 that may be closed by this pull request
- Renamed validate_browser_path() → validate_browser_paths()
- Updated chrome.py to pass a list of possible paths per OS
- Updated tests to use validate_browser_paths() instead of validate_browser_path()
@dannysigalovich dannysigalovich changed the title fix(chrome): update binary detection to support both Program Files and Program Files (x86) for Windows fix: support multiple default Chrome paths on each OS Mar 11, 2025
@thalissonvs
Copy link
Owner

Nice @dannysigalovich! You just have to fix the formatation now. Run poetry run task lint and see where's broken. Also, the tests still not passing

@codecov-commenter
Copy link

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

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Flag Coverage Δ
tests 97.31% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
pydoll/browser/chrome.py 93.75% <100.00%> (ø)
pydoll/browser/managers.py 98.76% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +155 to +159
if path == '/first/fake/path':
return False
elif path == '/second/fake/path':
return True
return False
Copy link
Owner

Choose a reason for hiding this comment

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

You can use a match here, since the min version of Python is 3.10:

match path:
    case "/first/fake/path":
        return False
    case "/second/fake/path":
        return True
    case _:
        return False

_get_default_binary_location=MagicMock(
return_value='/fake/path/to/browser'
),
Browser,
Copy link
Owner

Choose a reason for hiding this comment

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

Can you remove the extra indentation to maintain the code style?

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

Successfully merging this pull request may close these issues.

Browser is not running!
3 participants