Exemplo n.º 1
0
        public SeleniumWrapper()
        {
            var driver_path     = Path.Combine(Directory.GetCurrentDirectory(), "chromedriver.exe");
            var driver_zip_path = Path.Combine(Directory.GetCurrentDirectory(), "chromedriver.zip");

            if (!File.Exists(driver_path))
            {
                NetCommon.GetDefaultClient().DownloadFile("https://chromedriver.storage.googleapis.com/72.0.3626.7/chromedriver_win32.zip", driver_zip_path);

                var zip = ZipFile.Open(driver_zip_path, ZipArchiveMode.Read);
                zip.Entries[0].ExtractToFile(driver_path);
                zip.Dispose();
                File.Delete(driver_zip_path);
            }
            var chromeDriverService = ChromeDriverService.CreateDefaultService($"{Directory.GetCurrentDirectory()}");

            chromeDriverService.HideCommandPromptWindow = true;
            var chrome = new ChromeOptions();

            chrome.AddArgument("--headless");
            driver = new ChromeDriver(chromeDriverService, chrome);
        }
Exemplo n.º 2
0
 public ScriptViewer(string js_url, int line = -1, int column = -1, bool no_pretty = false)
 {
     init_with_code(NetCommon.DownloadString(js_url), line, column, no_pretty);
 }