본문 바로가기
etc/프로그래밍

python browser control

by 칸타렌서 2019. 8. 9.

 

Input command at cmd for selenium install

: pip install selenium 

 

 

 

Check my version of Chrome browser 

 

 

Chrome: https://sites.google.com/a/chromium.org/chromedriver/downloads
Edge: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Firefox: https://github.com/mozilla/geckodriver/releases
Safari: https://webkit.org/blog/6900/webdriver-support-in-safari-10/

 

Download ChromeDriver 

and put in the python folder 

 

 

 

Coding test 

 

from selenium import webdriver
driver = webdriver.Chrome("C:\\Python\\chromedriver.exe")
driver.get("http://www.google.co.kr")   # Google 접속
elem = driver.find_element_by_name("q") # 검색창 찾기

elem.clear()
elem.send_keys("hello") # 검색어 입력
elem.submit()           # 검색
assert "OOOOOOOOOK." not in driver.page_source

driver.close()  #브라우저 종료

 

 

If showed error, check the version

 

 

Selenium Documentation — Selenium Documentation

 

www.seleniumhq.org

 

HTML Tutorial

HTML5 Tutorial HTML is the standard markup language for Web pages. With HTML you can create your own Website. HTML is easy to learn - You will enjoy it! Examples in Every Chapter This HTML tutorial contains hundreds of HTML examples. With our online HTML e

www.w3schools.com

 

댓글