tldr; /usr/local/bin/chromedriver is not executable (needs chmod +x)
I am not able to get selenium/splinter to work due to permission issues.
I set the paths as per https://morph.io/documentation/scraping_javascript_sites:
chrome_options = ChromeOptions()
chrome_options.binary_location = '/usr/bin/google-chrome'
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
with Browser('chrome', executable_path='/usr/local/bin/chromedriver', headless=True, options=chrome_options) as browser:
browser.visit(URL)
But getting the following stack trace (see https://morph.io/dcalde/cityperthscraper)
Traceback (most recent call last):
File "scraper.py", line 47, in <module>
with Browser('chrome', executable_path='/usr/local/bin/chromedriver', headless=True, options=chrome_options) as browser:
File "/app/.heroku/python/lib/python3.6/site-packages/splinter/browser.py", line 92, in Browser
return get_driver(driver, *args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/splinter/browser.py", line 70, in get_driver
raise err
File "/app/.heroku/python/lib/python3.6/site-packages/splinter/browser.py", line 66, in get_driver
return driver(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/splinter/driver/webdriver/chrome.py", line 43, in __init__
self.driver = Chrome(options=options, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 88, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
I checked the file permissions, and while chrome itself is executable, chrome driver isn’t (at least not the user):
/usr/local/bin/chromedriver: -rwx------
/usr/bin/google-chrome: -rwxr-xr-x