inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

파이썬 입문 및 웹 크롤링을 활용한 다양한 자동화 어플리케이션 제작하기

웹 브라우저 없는 스크랩핑 및 파싱 실습(1) - 인프런

파이어폭스 CLI 환경 예제 질문

287

SeungMin Hyun

작성한 질문수 6

0

import sys

import io

from selenium import webdriver

from selenium.webdriver.firefox.options import Options

import time

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')

sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')

firefox_options = Options()

firefox_options.add_argument("--headless")   #CLI

driver = webdriver.Firefox(firefox_options=firefox_options,executable_path='C:\python\section3\webdriver\firefox\geckodriver')

#driver = webdriver.Chrome('C:\python\section3\webdriver\chrome\chromedriver')

#driver.set_window_size(1920,1280)

#driver.implicitly_wait(5)

driver.get("https://google.com")

#time.sleep(5)

driver.save_screenshot("C:\python\screenshot\website_ff1.png")

#driver.implicitly_wait(5)

driver.get('http://daum.net')

#time.sleep(5)

driver.save_screenshot("C:\python\screenshot\website_ff2.png")

driver.quit()

print("스크린샷 완료")

==================================================

경로도 틀리지 않았고 말씀하신대로 파일도 제대로 다 넣어있었고, 크롬에서의 예제는 제대로 실행되었는데 파이어폭스만 에러가 뜹니다

FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

'geckodriver' executable needs to be in PATH. 

python 웹-크롤링

답변 1

0

좋은사람

안녕하세요.

경로가 맞지 않아 나오는 에러 같습니다.

아래 코드 보고 사용해보시구요!

from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'your\path\geckodriver.exe')
driver.get('http://inventwithpython.com')

그래도 안되면 새로운 파이어폭스 드라이버로 한 번 다운받아서 진행해 보시구요! 

https://github.com/mozilla/geckodriver/releases

현재 예제에서 error 발생

0

389

3

유튜브 동영상 다운로드

0

1481

2

Atom 에디터 관련

0

351

1

위시켓 폼데이터

0

284

1

스케줄러 사용 관련 질문 드립니다

0

642

1

selenium 에러

0

440

1

Progress bar 쓰레드 관련

0

499

1

Install Package 관련 문의

0

338

1

tkinter 샘플 코드 실행 오류 건

0

1278

1

4-7-6 네이버 & 카카오 주식 정보 가져오기

0

390

1

네이버자동로그인_by_selenium

0

883

1

위시캣 로그인 처리 및 크롤링 질문

0

354

1

2-8-1 네이버이미지 크롤링 질문

1

616

3

li:nth-of-type 질문

0

358

2

에러가 뜨는데 잘 모르겠어요ㅠ

0

406

2

Install Packages 항목이 안보이는 이유가 뭘까요?

0

410

2

환경변수 Path 설정 방법

0

642

1

웹 브라우저 없는 스크랩핑 및 파싱 실습(1) - 인프런

0

344

1

웹 브라우저 없는 스크랩핑 및 파싱 실습(1) -git주소

0

495

3

download2-8-1. py질문

0

212

1

ip 차단 당하는 거 같은데 아무리 랜덤주고, sleep 줘도 안 되는데 다른 방법 더 있을까요??

0

649

1

인프런 환경이 바뀌어서 제나름대로 하는데

0

199

1

다시올려주신 예제파일로하는데

0

194

1

아직도 에러가뜨나보네요?

0

591

1