전체 글
-
[Selenium] 크롬 디버깅 모드 여러 개의 브라우저 실행하기카테고리 없음 2026. 5. 10. 00:27
디버깅 모드로 여러 개의 브라우저를 실행시키기 위해서는디버깅 port와, user 프로필을 변경해 실행할 수 있다. 1. 1번 디버깅 브라우저 실행subprocess.Popen([ r"C:\Program Files\Google\Chrome\Application\chrome.exe", "--remote-debugging-port=9222", "--user-data-dir=C:\\profile1", "--incognito"])# 2. 2번 디버깅 브라우저 실행subprocess.Popen([ r"C:\Program Files\Google\Chrome\Application\chrome.exe", "--remote-debugging-port=9223", "--user-dat..
-
[Selenium] 크롬 디버깅 모드에서 브라우저 종료(quit) 시키기Memo/Python 2026. 5. 10. 00:24
기존 일반적인 webdriver를 사용할 때는, `driver.quit()` 으로 열려있는 브라우저를 종료할 수 있었다.하지만 디버깅 모드로 실행 된 브라우저는 면밀히 따지면 Selenium에서 실행된 브라우저가 아닌,터미널(OS)에서 실행 된 브라우저로 quit()으로는 종료시킬 수 없다. 이에 디버깅 모드를 실행시킨 `subprocess`를 종료시키는 방법으로 브라우저를 종료시킬 수 있다.chrome = subprocess.Popen(...)# subprocess 종료(브라우저도 함께 종료)chrome.terminate()
-
[Selenium] 크롬 디버깅 모드로 실행 / 옵션 추가Memo/Python 2026. 5. 10. 00:09
특수한 경우 Selenium에서 브라우저를 실행할 때 디버깅 모드로 실행해야하는 경우가 있다(예, 구글 Captcha 우회, Bot 탐지 우회) Selenium에서 브라우저를 디버깅 모드로 실행하는 방법은 다음과 같다.import subprocess# subprocess는 파이썬 프로그램에서 운영체제의 명령어를 실행할 수 있게 해주는 모듈# -> 디버그 모드 실행 명령어를 작동시킴subprocess.Popen(r'C:\Program Files\Google\Chrome\Application\chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\chromeTemp"')options = webdriver.ChromeOptions()options.add_ex..
-
[Selenium] 열린 브라우저에서 크롤링 (크롬 디버깅 모드)Memo/Python 2024. 7. 6. 14:19
1. 크롬 디버깅 모드 실행# 실행창(Win + R)에서 실행C:\Program Files\Google\Chrome\Application\chrome.exe --remote-debugging-port=9222 --user-data-dir="C:/ChromeTEMP"# 또는C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --remote-debugging-port=9222 --user-data-dir="C:/ChromeTEMP"# Bat 파일로 제작해 두면 편리하게 실행 가능# 또 다른 방법cd C:\Program Files\Google\Chrome\Application.\chrome.exe --remote-debugging-port=9222 --u..
-
[Selenium] Captcha 이미지 저장. 요소 캡쳐 저장하기Memo/Python 2024. 7. 6. 14:12
Captcha 이미지와 같이 보안 등의 문제로 웹상의 이미지를 파일로 저장하기 어려운 경우가 존재한다.이럴 경우 크롬의 캡쳐 기능을 이용해 원하는 이미지를 손쉽게 저장할 수 있다.img = driver.find_element(By.XPATH, "요소") # 이미지 요소 찾기img.screenshot('image.png') # 이미지 요소 저장 How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the w..
-
[Selenium] 요소를 찾지 못하는 경우, frame 안의 요소 가져오기Memo/Python 2024. 3. 4. 19:57
평소와 같은 방법으로 페이지의 요소를 가져오려 했다. 그런데 아무리 요소를 검색하여도 "no such element: element not found" 문구가 출력되며 요소를 가져올 수 없었다. 검색해 본 결과 frame(iframe, frameset) 안의 요소를 가져오기 위해서는 frame 안으로 이동하여 요소를 검색해야 했다. frame = driver.find_element(By.TAG_NAME, "frame") # 프레임 요소 선택 driver.switch_to.frame(frame) # 프레임 전환 위와 같이 프레임을 전환해 주니 평소와 같이 요소를 가져올 수 있었다. Selenium에서 #document 안으로 들어가기 Selenium을 이용해 크롤링 하다보면 iframe 안의 내용은 가져오..
-
[Flutter] json 데이터 한글 깨짐 현상. 해결 방법Memo/Dart & Flutter 2024. 2. 22. 22:23
⚠️ 문제 json 데이터를 가져와 출력하는 과정에서 사진과 같이 글자가 깨지는 현상이 발생하였다. 💡 원인 json을 디코딩하는 과정에서 EUC-KR 데이터를 유니코드 기반으로 잘못 해석하여 발생한 문제로 보인다. ✅ 해결 데이터를 UTF-8 방식으로 디코딩하여 해결할 수 있었다. jsonDecode(response.body); // 기존 코드 // to jsonDecode(utf8.decode(response.bodyBytes)); // 개선 코드 🔗 참고 자료 [flutter] 24... jsonDecode(한글깨짐 현상) 마침 지금 공부하는 부분과 프로젝트 부분이 흡사하여 내가 맟은 영역은 아니지만 구현해보았다. 배운거를 복습한다는 느낌으로 따라해보니 스무스하게 잘됐다. 코드에 오류없어 에뮬을 돌..
-
[SQLAlchemy] declarative_base() function is now available as sqlalchemy.orm.declarative_base(). 경고 해결Memo/Python 2024. 2. 19. 17:32
⚠️ 문제 Python 프로젝트를 실행하는 과정에서 아래와 같은 SQLAlchemy 경고 문구가 발생하였다. MovedIn20Warning: The ``declarative_base()`` function is now available as sqlalchemy.orm.declarative_base(). (deprecated since: 2.0) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) 💡 원인 'declarative_base' 함수를 import 하는 과정에서 이전 방식을 사용하여 발생한 문제였다. ✅ 해결 아래와 같이 import문을 수정해 해결할 수 있었다. from sqlalchemy.ext.declarative import de..