I have VB.net code that utilizes Selenium and the Chrome driver to navigate to a page and download a file. It works fine with and without headless options specified. But I want to suppress the command window also. Based on what I read, I need to launch the ChromeDriver specifying 'true' for the HideCommandPromptWindow property. When I do this, I get this error:
OpenQA.Selenium.DriverServiceNotFoundException HResult=0x80131500 Message=The file False\chromedriver.exe does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html Source=WebDriver StackTrace: at OpenQA.Selenium.DriverService..ctor(String servicePath, Int32 port, String driverServiceExecutableName, Uri driverServiceDownloadUrl) at OpenQA.Selenium.Chrome.ChromeDriverService..ctor(String executablePath, String executableFileName, Int32 port) at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options) at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory)
I'm using the path that appears in the TitleBar of the CommandWindow I see when it runs and works, so I know the path and file are valid.
Based on the fact that the error Message of 'The file False\chromedrive.exe does not exist...' it seems that the arg I'm passing for the path is somehow evaluating as 'False'.
This is a snippet of the code being run - it errors at line 219 or 220:
Dim cOpt As New ChromeOptions()
cOpt.AddArguments("--headless", "--no-sandbox", "--disable-gpu")
Dim param As New Dictionary(Of String, Object)
param.Add("behavior", "allow")
param.Add("downloadPath", G.gRadiusExportsFolder)
Dim cdp As String = FixPathSlash(My.Application.Info.DirectoryPath, False)
Dim d As New ChromeDriver(cOpt)
'LINE 219-- Dim d As New ChromeDriver(ChromeDriverService.CreateDefaultService(cdp, "chromedriver.exe").HideCommandPromptWindow = True)
'LINE220-- Dim d As New ChromeDriver(ChromeDriverService.CreateDefaultService(cdp, "chromedriver.exe").HideCommandPromptWindow = True, cOpt)
Wait(5)
d.ExecuteChromeCommand("Page.setDownloadBehavior", param)