-
-
ChromeDriverService driverService = ChromeDriverService.CreateDefaultService();
-
driverService.HideCommandPromptWindow = 진짜;// 검은색 cmd 창을 닫습니다.
-
-
Chrome옵션 옵션 = 새로운 크롬 옵션();
-
// 비 새로 고침 장치
-
//options.AddArgument(“–headless”);
-
// GPU 가속으로 인해 ChromeOutput 최신 블랙 스크린 및 CPU가 발생할 수 있습니다.
-
options.AddArgument(“–비활성화-gpu”);
-
// 가장 사용자 에이전트
-
options.AddArgument(“user-agent=Mozilla/5.0(iPhone; Mac OS X와 같은 CPU iPhone OS 10_3) AppleWebKit/602.1.50(Gecko와 같은 KHTML) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1”);
-
// 크롬 크기 줄이기
-
options.AddArgument(“–창 크기=414,736”);
-
// 예시 사용
-
options.AddUserProfilePreference(“profile.default_content_setting_values.images”, 2);
-
-
IWebDriver-Selenium = 새로운 ChromeDriver(드라이버 서비스, 옵션);
-
//5S 이내에 검색 요소를 찾지 못한 경우
-
selenium.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
-
끈 URL = “https://www.baidu.com“;
-
selenium.Navigate().GoToUrl(url);