Reputation: 1
I have created a Blazor server webapp that uses Selenium to scrape a canvas tab on an external website. The webapp works fine when I run it in Visual Studio, but it creates an exception when deployed to Azure. The exception message is:
WebDriverException: Selenium Manager process exited abnormally with 65 code: C:\home\site\wwwroot\selenium-manager\windows\selenium-manager.exe --browser "chrome" --language-binding csharp --output json Standard Output >> { "logs": [ { "level": "ERROR", "timestamp": 1739662865, "message": "There is not enough space on the disk. (os error 112)" } ], "result": { "code": 65, "message": "There is not enough space on the disk. (os error 112)", "driver_path": "", "browser_path": "" } }
The relevant Blazor code is:
using HtmlAgilityPack;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
public class CanvasScraperService
{
private static string YahooAnalysisURL(string ticker)
{
var tickerUpper = ticker.ToUpper();
return $"https://finance.yahoo.com/quote/{tickerUpper}/analysis/";
}
public string ScrapeCanvasImage(string ticker)
{
// Set up Chrome options for headless mode
var options = new ChromeOptions();
options.AddArgument("--headless"); // Runs in headless mode (no GUI)
options.AddArgument("--disable-gpu");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
using IWebDriver driver = new ChromeDriver(options);
//Set the maximum wait time for the page to load
driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(5);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
try
{
driver.Navigate().GoToUrl(YahooAnalysisURL(ticker));
//Wait for the page to load completely
System.Threading.Thread.Sleep(1000);
}
//The page might not fully load within the specified time. Ignore the exception if it occurs.
catch (WebDriverTimeoutException)
{
}
// Execute JavaScript to get the canvas data URL. The canvas element is the third canvas element on the page.
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
string script = @"var canvasList = document.querySelectorAll('canvas');
return canvasList[2].toDataURL('image/png');
";
string dataUrl = (string)js.ExecuteScript(script);
driver.Quit();
return dataUrl;
}
}`
Upvotes: 0
Views: 40
Reputation: 18328
Looks like you are using a self-hosted agent on a windows machine. This machine may be provided to you by your IT or DevOps team.
As the error suggests ‘There is not enough space on the disk. (os error 112)‘ your self-hosted build agent is out of disk space.
Typically, build agents are recycled frequently to prevent side-effects (such as out of disk space issues). Run the maintenance job on the agent to clear out stale workspaces. If this doesn’t help, temporarily take the agent offline, wait for current jobs to finish then remote into the machine and clear the ‘_work‘ directory.
Upvotes: 0