[파이썬]네이버 데이터랩 추출 및 엑셀 파일 저장(xlsx)
# Script/Python2022. 10. 11. 07:42[파이썬]네이버 데이터랩 추출 및 엑셀 파일 저장(xlsx)

from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.action_chains import ActionChains import chromedriver_autoinstaller import os import requests import warnings import shutil import subprocess import time warnings.filterwarnings('ignore') try: shutil.rmtree(r"c:\chrometemp") # 쿠키 / 캐쉬파일 삭제 except FileNotFoundError: pass subprocess...

[파이썬]셀레니움 크롬 드라이버 자동 설치 for windows
# Script/Python2022. 10. 10. 15:22[파이썬]셀레니움 크롬 드라이버 자동 설치 for windows

from selenium import webdriver import chromedriver_autoinstaller import os # Check if chrome driver is installed or not chrome_ver = chromedriver_autoinstaller.get_chrome_version().split('.')[0] driver_path = f'./{chrome_ver}/chromedriver.exe' if os.path.exists(driver_path): print(f"chrom driver is insatlled: {driver_path}") else: print(f"install the chrome driver(ver: {chrome_ver})") chromedriv..

[파이썬]bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed error
# Script/Python2021. 5. 19. 22:36[파이썬]bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed error

exe파일로 만든 후 실행시 콘솔에 아래와 같이 오류 발생 Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed error 아래코드 추가 후 해결 options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) driver = webdriver.Chrome(options=options)

[파이썬]셀레니움을 이용한 특정부분만 하이라이트 적용
# Script/Python2021. 5. 7. 10:59[파이썬]셀레니움을 이용한 특정부분만 하이라이트 적용

from selenium import webdriver driver = webdriver.Chrome('C:\\Users\\ryzen3\\Downloads\\chromedriver.exe') driver.get("https://darksharavim.tistory.com/") elements = driver.find_element_by_css_selector("#ttItem1547528381 > ul > li.tt-span-12.tt-last.tt-clear > div:nth-child(1)") driver.execute_script("arguments[0].style.backgroundColor = 'yellow'; return arguments[0];", elements) 참고 URL : www.py..

[파이썬]unknown error: DevToolsActivePort file doesn't exist
# Script/Python2021. 4. 30. 16:47[파이썬]unknown error: DevToolsActivePort file doesn't exist

파이썬 실행시 아래와 같이 오류발생할 경우 unknown error: DevToolsActivePort file doesn't exist 아래내용 추가 from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument("--single-process") chrome_options.add_argument("--disable-dev-shm-usage") driver = webdriver.Chrome("./chromedriver",chrome_..

image