spinlud / py-linkedin-jobs-scraper

MIT License
311 stars 86 forks source link

'chromedriver' executable needs to be in PATH #2

Closed iqbalbasyar closed 3 years ago

iqbalbasyar commented 3 years ago

Hi,

I have passed my webdriver options to set my chromedriver location. But still got an webdriver exception 'chromedriver' executable needs to be in PATH'

I'm running on macos bigsur


options = webdriver.ChromeOptions()
options.binary_location = os.environ['CHROME_DRIVER_PATH']

scraper = LinkedinScraper(
    chrome_options=options,  # You can pass your custom Chrome options here
    headless=True,  # Overrides headless mode only if chrome_options is None
    max_workers=1,  # How many threads will be spawned to run queries concurrently (one Chrome driver for each thread)
    slow_mo=0.4,  # Slow down the scraper to avoid 'Too many requests (429)' errors
)

# Add event listeners
scraper.on(Events.DATA, on_data)
scraper.on(Events.ERROR, on_error)
scraper.on(Events.END, on_end)

query = Query(
    query='My Job',
    options=QueryOptions(
        locations=['Malaysia'],
        optimize=False,
        limit=2000,
        filters=QueryFilters(            
            relevance=RelevanceFilters.RECENT,
            time=TimeFilters.MONTH,
            type=[TypeFilters.FULL_TIME, TypeFilters.INTERNSHIP],
            experience=[ExperienceLevelFilters.INTERNSHIP, ExperienceLevelFilters.MID_SENIOR],
        )
    )
)

scraper.run([query])
spinlud commented 3 years ago

Hi there, I have added the option to define the Chrome executable path in the scraper constructor:

scraper = LinkedinScraper(
        chrome_executable_path='/foo/bar/bin/chromedriver',
        chrome_options=None,
        headless=True,
        max_workers=1,
        slow_mo=0.8,
    )

Can you try that and let me know?