1010# of linux is required for the script to run correctly as well.
1111# Otherwise, use pyvirtualdisplay.
1212
13- import sys , os , platform , time
13+ import sys , os , time
1414from selenium import webdriver
1515from selenium .common .exceptions import WebDriverException
1616from selenium .webdriver .firefox .firefox_binary import FirefoxBinary
@@ -35,12 +35,14 @@ class bcolors:
3535 # Find the path to chromedriver
3636 chromedriver_path = "chromedriver"
3737 if sys .platform .startswith ("linux" ):
38- if 'Ubuntu' in platform .linux_distribution ():
39- chromedriver_path = "/usr/lib/chromium-browser/chromedriver"
40- elif 'debian' in platform .linux_distribution ():
41- #Debian is lowercase when platform.linux_distribution() is used.
42- #This is not a mistake.
43- chromedriver_path = "/usr/lib/chromium/chromedriver"
38+ locations = (
39+ "/usr/lib/chromium-browser/chromedriver" ,
40+ "/usr/lib/chromium/chromedriver" ,
41+ )
42+ for location in locations :
43+ if os .path .isfile (location ):
44+ chromedriver_path = location
45+ break
4446
4547 try :
4648 # First argument is optional, if not specified will search path.
0 commit comments