cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

webdriver.Chrome() error : Message: Unable to locate or obtain driver for chrome

Silveryaroma
New Contributor

Hi, I've been struggling to run webdriver.Chrome() in my Databricks. 


1) I installed a chromedriver :

 

%sh
# Download ChromeDriver
wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip -O /tmp/chromedriver.zip

# Remove the existing directory if it exists
rm -rf /tmp/chromedriver
 
mkdir /tmp/chromedriver
unzip /tmp/chromedriver.zip -d /tmp/chromedriver/

chmod +x /tmp/chromedriver/chromedriver-linux64/chromedriver
 
output : 
Archive: /tmp/chromedriver.zip
inflating: /tmp/chromedriver/chromedriver-linux64/LICENSE.chromedriver
inflating: /tmp/chromedriver/chromedriver-linux64/chromedriver
 
2) check it is indeed installed :
ls /tmp/chromedriver/chromedriver-linux64/
 
output :
LICENSE.chromedriver chromedriver
 
3) run the script
 
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

# Create the Service object with the correct path to chromedriver
chrome_service = Service(executable_path='/tmp/chromedriver/chromedriver-linux64/chromedriver.exe')

options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--disable-extensions")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
options.add_experimental_option("prefs",{"download.default_directory":"/databricks/driver"})

# Create the WebDriver instance
driver = webdriver.Chrome(service=chrome_service, options=options)
 
 
 
However, I keep getting this error message "Unable to locate or obtain driver for chrome" in the last line where I run webdriver.Chrome()
Silveryaroma_0-1699524392121.png

 

Does anyone know what the problem is?

 
0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group