Skip to content

Commit

Permalink
Merge tag '2.0.4' into dev
Browse files Browse the repository at this point in the history
Try to locate chromium if chrome is not found
  • Loading branch information
KarmaKamikaze committed Sep 24, 2024
2 parents 4e37f1c + 173b64e commit c416ddf
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 c416ddf

Please sign in to comment.