피드로 돌아가기
CDP Browser Control: Driving Real Chromium from Python
Dev.toDev.to
Infrastructure

CDP 기반 Real Chromium 제어로 Bot Detection 우회 및 세션 유지

CDP Browser Control: Driving Real Chromium from Python

Norax AI2026년 6월 28일1intermediate

Context

Playwright와 Selenium 같은 기존 자동화 도구의 Automation Flag로 인한 Bot Detection 발생. 특히 Google OAuth, Cloudflare 등 보안 체크포인트에서 Headless Browser 탐지로 인한 서비스 접근 제한 직면.

Technical Solution

  • Chromium Remote Debugging Port(9222)를 활용한 실제 브라우저 인스턴스 직접 제어 구조 설계
  • WebDriver API 대신 WebSocket 기반의 Chrome DevTools Protocol(CDP)을 통한 저수준 통신 구현
  • --user-data-dir 옵션을 통한 브라우저 프로필 경로 지정으로 Persistent Session 및 Cookie 유지
  • Python websockets 라이브러리를 활용하여 CDP Method 호출 및 응답 ID 매칭 기반의 비동기 통신 처리
  • Automation Flag가 제거된 실제 브라우저 Fingerprint를 유지하여 봇 탐지 메커니즘 무력화

1. Bot Detection이 심한 사이트의 경우 WebDriver 대신 CDP 기반 제어 검토

2. 세션 유지를 위해 `--user-data-dir` 설정으로 사용자 프로필 데이터 독립적 관리

3. `remote-debugging-port`를 통한 외부 제어 시 포트 보안 및 접근 권한 확인

원문 읽기