I downloaded the chrome web driver for scraping, I then installed the C# Nuget Selenium package and wrote the following code below to start the scraping process, I then get an exception with the message that I have used an invalid argument in the options supplied to the Web Driver constructor
<code> try
{
string chrome_path = "C:\Users\HP\PycharmProjects\Scraping\chromedriver.exe";
//try and use the web driver to mine for the odds from the site
var data = new Dictionary<string, List<string>>()
{
{"Home", new List<string>() },
{"Draw", new List<string>() },
{"Away", new List<string>() },
};
//define options to run the driver
var options = new ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
//create a new driver
using (var driver = new ChromeDriver(chrome_path, options))
{
//navigate to the required URL
driver.Navigate().GoToUrl("wwww.betexplorer.com");
//scroll the page for the elements to become fully rendered
}
}catch (WebDriverArgumentException ex)
{
MessageBox.Show($"An error occurred: {ex.Message}");
}
}
</code>
<code> try
{
string chrome_path = "C:\Users\HP\PycharmProjects\Scraping\chromedriver.exe";
//try and use the web driver to mine for the odds from the site
var data = new Dictionary<string, List<string>>()
{
{"Home", new List<string>() },
{"Draw", new List<string>() },
{"Away", new List<string>() },
};
//define options to run the driver
var options = new ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
//create a new driver
using (var driver = new ChromeDriver(chrome_path, options))
{
//navigate to the required URL
driver.Navigate().GoToUrl("wwww.betexplorer.com");
//scroll the page for the elements to become fully rendered
}
}catch (WebDriverArgumentException ex)
{
MessageBox.Show($"An error occurred: {ex.Message}");
}
}
</code>
try
{
string chrome_path = "C:\Users\HP\PycharmProjects\Scraping\chromedriver.exe";
//try and use the web driver to mine for the odds from the site
var data = new Dictionary<string, List<string>>()
{
{"Home", new List<string>() },
{"Draw", new List<string>() },
{"Away", new List<string>() },
};
//define options to run the driver
var options = new ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
//create a new driver
using (var driver = new ChromeDriver(chrome_path, options))
{
//navigate to the required URL
driver.Navigate().GoToUrl("wwww.betexplorer.com");
//scroll the page for the elements to become fully rendered
}
}catch (WebDriverArgumentException ex)
{
MessageBox.Show($"An error occurred: {ex.Message}");
}
}
The error invalid argument session-info: chrome-headless-shell=125.0.6422.113