소스 검색

chromeのバージョン固定化

master
sosuke.iwabuchi 2 년 전
부모
커밋
7b46b26003
1개의 변경된 파일7개의 추가작업 그리고 12개의 파일을 삭제
  1. +7
    -12
      CSVDownloader/Web/DriverFactory.cs

+ 7
- 12
CSVDownloader/Web/DriverFactory.cs 파일 보기

@@ -10,12 +10,12 @@ using SeleniumExtras.WaitHelpers;

namespace CSVDownloader.Web {
class DriverFactory {
public static ChromeDriver GetDriver()
{
public static ChromeDriver GetDriver() {
CreateDir();

var options = new ChromeOptions();
// options.AddArgument("--headless");
options.BinaryLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\chrome-win64\\chrome.exe";
String download_dir = GetTmpDownloadDir();
options.AddUserProfilePreference("download.default_directory", download_dir);
ChromeDriver driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
@@ -26,28 +26,23 @@ namespace CSVDownloader.Web {
return driver;
}

public static String GetTmpDownloadDir()
{
public static String GetTmpDownloadDir() {
return Path.GetFullPath("tmp_download");
}

public static String GetDownloadDir()
{
public static String GetDownloadDir() {
return Path.GetFullPath("download");
}

private static void CreateDir()
{
private static void CreateDir() {
String tmpdownload_dir = GetTmpDownloadDir();
String download_dir = GetDownloadDir();

if (!Directory.Exists(tmpdownload_dir))
{
if (!Directory.Exists(tmpdownload_dir)) {
Directory.CreateDirectory(tmpdownload_dir);
}

if (!Directory.Exists(download_dir))
{
if (!Directory.Exists(download_dir)) {
Directory.CreateDirectory(download_dir);
}
}


Loading…
취소
저장