Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
PhantomJs ile Screenshot (Ekran Yakalama) C# - RAGIP ÜNAL

Blog

PhantomJs ile Screenshot (Ekran Yakalama) C#

Merhabalar; Bu ara yoğunlukla çalıştığım Web Scraping konularında çalışmaktayım. Ara ara kullandığın ekran yakalama kodunu sizlerle paylaşıyorum.

Javascript devre dışı bırakarak ziyareti gerçekleştiriyorum.

var opts = new PhantomJSOptions();
opts.AddAdditionalCapability("phantomjs.page.settings.javascriptEnabled", false);
var service = PhantomJSDriverService.CreateDefaultService(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "bin", "phantomjs.exe");
using (var driver = new PhantomJSDriver(service, opts, TimeSpan.FromSeconds(90)))
{
    driver.Manage().Window.Maximize();
    driver.Navigate().GoToUrl(recordItem.InternetData.Url);
    
    Screenshot screenShot = ((ITakesScreenshot)driver).GetScreenshot();
    switch (this.Setting.Image.imageExtention.Replace(".", ""))
    {
        case "jpeg":
        case "jpg":
            screenShot.SaveAsFile(ScreenShotFileName, ImageFormat.Jpeg);
            break;
        case "png":
            screenShot.SaveAsFile(ScreenShotFileName, ImageFormat.Png);
            break;
        case "bmp":
            screenShot.SaveAsFile(ScreenShotFileName, ImageFormat.Bmp);
            break;
        default:
            screenShot.SaveAsFile(ScreenShotFileName, ImageFormat.Jpeg);
            break;
    }
    driver.Quit();
}

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir