I've tried to search, but haven't found a definitive answer. On Windows Server 2016 WITHOUT Chrome Browser actually installed. I downloaded the correct "chromedriver.exe" and placed it in "D:Appschromedriver.exe". I have added to my environment PATH the full path as "D:Appschromedriver.exe".
When I attempt to start my Windows Service that utilizes the latest Selenium, I get the following error:
Exception occurred: Failed initializing web driver: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.14393 x86_64)
Question: Do I have to actually install the full-blown browser in addition to the chromedriver, or is this simply just not finding the chromedriver.exe in my Python code (included below for full disclosure):
def __init__(self, username, password, environment='cert'):
self.username = username
self.password = password
self.environment = environment
# Instantiate a chrome options object so you can set the size and headless preference
self.chrome_options = Options()
# Toggle Headless or not
if HEADLESS_TOGGLE == 1:
self.chrome_options.add_argument("--headless")
self.chrome_options.add_argument("--disable-gpu") # Disables "Lost UI Shared Context GPU Error on Windows"
self.chrome_options.add_argument('--disable-extensions') # Disables Extensions
self.chrome_options.add_argument("--disable-software-rasterizer") # Disables "Lost UI Shared Context GPU Error on Windows"
self.chrome_options.add_argument("--window-size=1024x768")
self.chrome_options.add_argument("--log-level=3") # Errors Only
self.chrome_options.add_argument("--incognito") # Keeps history and logs clear
self.chrome_options.add_argument("--no-sandbox")
self.chrome_options.add_argument("--mute_audio") # No loud surprises!
self.chrome_options.add_argument("--no-gpu") # Disables gpu-based errors (headless)
self.driver = webdriver.Chrome(chrome_options=self.chrome_options)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…