Tôi gặp lỗi chung xảy ra trong GDI + cho selenium webdriver.Nó đã hoạt động tốt vào hôm qua, Nhưng đột nhiên tôi nhận được lỗi này.Lỗi chung xảy ra trong GDI + selenium webdriver
public string TakeScreenshot(IWebDriver driver, string SnapFolderPath, string TCID, string KeyFunction)
{
try
{
// driver.Manage().Window.Maximize();
ITakesScreenshot ssdriver = driver as ITakesScreenshot;
Screenshot screenshot = ssdriver.GetScreenshot();
string filePath = testReport + "\\" + TCID + "_" + KeyFunction + "_" + GetDateTimeforFilePath() + ".png";
screenshot.SaveAsFile(filePath, ImageFormat.Png);
return filePath;
}
catch (Exception ex)
{
return string.Empty;
}
}
ngoại lệ bên ngoài:. {" Đã xảy ra lỗi chung trong GDI +. "} – Pat
Tôi thấy bạn đã giải quyết nó, nhưng chỉ để tham khảo thêm, điều này không đến từ Selenium, điều này xuất phát từ thư viện GDI. (Selenium chỉ gọi một số mã .NET từ Microsoft để lưu ảnh chụp màn hình) – Arran