0

I am using selenium in asp core 3.1, in local it's working, but in server windows 2012 there's an error:

WebDriverException: unknown error: no chrome binary

I set binary and driver:

var chromeOptions = new ChromeOptions();
chromeOptions.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";            
_driver = new ChromeDriver(Path.Combine(hostingEnvironment.WebRootPath), chromeOptions);

but not work

matthias_h
  • 11,356
  • 9
  • 22
  • 40
mahdi
  • 1

1 Answers1

0

In local this works, since it is an absolute path, relating to your system.

chromeOptions.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"; 

This of-course will not work on the server, as this would fail as it's not the same path. You would ideally want to use a relative path style.

AzyCrw4282
  • 7,222
  • 5
  • 19
  • 35
  • how do i relative path style? – mahdi Apr 11 '20 at 19:48
  • This must simply be a path issue, and nothing else. Can you try this `chromeOptions.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"; `. And also make sure that it's the correct binary ` – AzyCrw4282 Apr 11 '20 at 22:51
  • Does `chrome.exe` actually exist in that path you've given? Is it not`Chrome.exe` or `ChromeDriver.exe`? For configuring relative path see [here](https://stackoverflow.com/questions/24028561/relative-path-in-html) – AzyCrw4282 Apr 12 '20 at 06:47
  • yes its exist, this is in local work, but not it work in server – mahdi Apr 12 '20 at 09:57
  • this path in server : "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" – mahdi Apr 12 '20 at 11:12