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

ValueError: Browser not found: /usr/bin/google-chrome #29

Closed
WittmannF opened this issue Mar 8, 2025 · 3 comments
Closed

ValueError: Browser not found: /usr/bin/google-chrome #29

WittmannF opened this issue Mar 8, 2025 · 3 comments

Comments

@WittmannF
Copy link

To my understanding, it doesn't require a chrome web-browser. Or am I missing something? Here's the error I got:

/Users/wittmannf/miniconda3/bin/python /Users/wittmannf/repos/misc/with_pydoll.py
Traceback (most recent call last):
  File "/Users/wittmannf/repos/misc/with_pydoll.py", line 8, in main
    await browser.start()
  File "/Users/wittmannf/miniconda3/lib/python3.12/site-packages/pydoll/browser/base.py", line 72, in start
    self.options.binary_location or self._get_default_binary_location()
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wittmannf/miniconda3/lib/python3.12/site-packages/pydoll/browser/chrome.py", line 27, in _get_default_binary_location
    return BrowserOptionsManager.validate_browser_path(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wittmannf/miniconda3/lib/python3.12/site-packages/pydoll/browser/managers.py", line 153, in validate_browser_path
    raise ValueError(f'Browser not found: {path}')
ValueError: Browser not found: /usr/bin/google-chrome

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/wittmannf/repos/misc/with_pydoll.py", line 16, in <module>
    asyncio.run(main())
  File "/Users/wittmannf/miniconda3/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/wittmannf/miniconda3/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wittmannf/miniconda3/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/wittmannf/repos/misc/with_pydoll.py", line 7, in main
    async with Chrome() as browser:
  File "/Users/wittmannf/miniconda3/lib/python3.12/site-packages/pydoll/browser/base.py", line 66, in __aexit__
    await self.stop()
  File "/Users/wittmannf/miniconda3/lib/python3.12/site-packages/pydoll/browser/base.py", line 210, in stop
    raise exceptions.BrowserNotRunning('Browser is not running')
pydoll.exceptions.BrowserNotRunning: The browser is not running

Running the following test on MacOS:

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())
@isaacwasserman
Copy link

It looks like the defaults just have Linux in mind, but you can override the executable location:

async def main():
    # Start the browser with no additional webdriver configuration!
    options = Options()
    options.binary_location = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
    async with Chrome(options=options) as browser:
        ...

CaioWzy added a commit to CaioWzy/pydoll that referenced this issue Mar 9, 2025
@thalissonvs
Copy link
Owner

thalissonvs commented Mar 9, 2025

we have an open PR from @CaioWzy to fix this problem
also, thanks for opening the issue :)

thalissonvs added a commit that referenced this issue Mar 9, 2025
fix: resolve issue #29 where browser path was not found on macOS
@thalissonvs
Copy link
Owner

@WittmannF Can you check if it's working now?

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

3 participants