일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- compare
- length
- Read
- inheritance
- file access
- Barcode
- flutter
- digitalRead
- wpf
- atmega328
- Encapusulation
- Contour
- SERIAL
- memory
- java
- mfc
- APP
- c++
- Class
- preprocessing
- parameter
- public
- Overloading
- Unity
- stream
- sensor
- aduino
- UNO
- Pointer
- Android
- Today
- Total
폴크(FOLC)
C# 테크닉 - 이미지 캡처 ( 크롤링 ) 본문
# 데이터를 수집하는 과정(Selenium 이용)에서 WebPage 상태를 그대로 캡처해서 파일로 저장
# 옵션 설정 확인
> ChromeOptions 에서 AddArgument("--start-maximized"); 추가
> ChromeOptions 에서 AddArgument("--start-fullscreen"); 추가
- 데이터 화면만 표시되도록 하기 위함.
> ChromeOptions 에서 AddArgument("headless"); 제거
- headless 를 사용하게 되면 WebPage 가 전체 화면으로 표시되지 않고 scroll 에 의해서 가려지는 현상 있음
# 소스 코드
public void ScreenshotFromUrlPage(ChromeDriver driver)
{
try
{
String drivePath = "c:\\Download";
String drivefilePath = drivePath + "\\Image1234.jpg";
DirectoryInfo di = new DirectoryInfo(drivepath);
if (di.Exists == false) di.Create();
Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot();
ss.SaveAsFile(drivefilePath, ScreenshotImageFormat.Jpeg);
}
catch (Exception e)
{
String str = e.Message;
}
}
'C#, WF, WPF(.NET) > C#, WF, WPF(.NET) 테크닉' 카테고리의 다른 글
C# 테크닉 - Page 전환 (0) | 2021.11.12 |
---|---|
WPF 테크닉 - Page 전환 (0) | 2021.11.12 |
C# 테크닉 - 이미지 뷰어 만들기 (0) | 2021.10.26 |
C# 테크닉 - 로그 기록하기 ( log4net ) (0) | 2021.10.13 |
C# 테크닉 - xls 파일에 Local Image 추가하기 (0) | 2021.10.11 |