Skip to content

Commit

Permalink
Try to locate chromium if chrome is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
KarmaKamikaze committed Sep 24, 2024
1 parent c163f2e commit 67f481c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions MoxfieldPriceScraper/MoxfieldScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private void InitializeWebDriver()
chromeOptions.AddArgument("--window-size=2560,1440"); // Set window size
chromeOptions.AddArgument("--log-level=3"); // Disable logging
chromeOptions.AddExcludedArguments("enable-logging"); // Disable logging
chromeOptions.BinaryLocation = GetChromeLocation();
var preferences = new Dictionary<string, object>
{
{ "profile.managed_default_content_settings.images", 2 } // Disable image loading
Expand All @@ -125,6 +126,19 @@ private void InitializeWebDriver()
Log.Debug("WebDriver initialized with ImplicitWait set to {Timeout}", _elementSeekTimeout);
}

/// <summary>
/// Gets the location of the Chrome/Chromium browser.
/// </summary>
/// <returns></returns>
private static string GetChromeLocation()
{
var options = new ChromeOptions
{
BrowserVersion = "stable"
};
return new DriverFinder(options).GetBrowserPath();
}

/// <summary>
/// Logs in to Moxfield with the provided credentials.
/// </summary>
Expand Down

0 comments on commit 67f481c

Please sign in to comment.