"Selenium"의 두 판 사이의 차이
(→외부링크) |
(→크롬 드라이버 설치) |
||
5번째 줄: | 5번째 줄: | ||
==크롬 드라이버 설치== | ==크롬 드라이버 설치== | ||
$ sudo apt install chromium-chromedriver | $ sudo apt install chromium-chromedriver | ||
+ | 버전이 맞지 않을 경우 수동다운로드: https://chromedriver.chromium.org/downloads | ||
== 샘플코드 == | == 샘플코드 == |
2020년 5월 22일 (금) 00:15 판
설치
$ pip3 install selenium
크롬 드라이버 설치
$ sudo apt install chromium-chromedriver
버전이 맞지 않을 경우 수동다운로드: https://chromedriver.chromium.org/downloads
샘플코드
from selenium import webdriver
# 드라이버 생성
# which chromedriver 의 위치를 넣어준다.
driver = webdriver.Chrome("/usr/bin/chromedriver")
driver.get("http://google.com")
html = driver.page_source
driver.close()
외부링크
Web Driver: https://selenium.dev/documentation/en/webdriver/
Web Element: https://www.selenium.dev/documentation/en/webdriver/web_element/