inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

크롤링할때 --headless 기능에 대해 질문드려요

89

양주원(상경대학 응용통계학과)

작성한 질문수 1

0

""" Chrome 옵션 설정 """

chrome_options = Options()

chrome_options.binary_location = "/bin/google-chrome"

chrome_options.add_argument('--no-sandbox')

chrome_options.add_argument("--headless")

chrome_options.add_experimental_option("detach", True)

chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"])

""" 서비스 및 웹드라이버 설정 """
# 올바른 경로 지정 
chromedriver_path = "/root/.wdm/drivers/chromedriver/linux64/131.0.6778.204/chromedriver-linux64/chromedriver"

# service = Service(executable_path=ChromeDriverManager().install())
service = Service(executable_path=chromedriver_path)
browser = webdriver.Chrome(service=service, options=chrome_options)

""" Yahoo Finance 페이지 접속 """
# Yahoo Finance News Crawling
browser.get("https://www.google.com")

linux를 사용하는 MLOps 환경이고

위는 jupyter notebook 코드의 일부인데,

이런 식으로 options를 설정하고 위의 코드를 실행하면 "--headless" 모드를 option에 추가하면 DevTools 미설치 오류가 발생하지 않고, 제외시키면 DevTools 미설치 오류가 발생하는데,

"--headless" 모드는 단순히 시각화여부를 결정하는 기능아닌가요? ㅠㅠ

답변 0

화면 깜박임 현상

2

57

1

17강 강의에 목데이터 첨부파일이 없습니다.

2

67

2

이력서의 자기 소개를 그대로 자기소개 할때 핵심 매력으로 소개하면 마이너스 일까요?

1

44

2

이북 다운로드 위치 문의

1

38

1