iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 30
0

python網路爬蟲教學-Selenium基本操作
download chrome drive
https://www.whatismybrowser.com/detect/what-version-of-chrome-do-i-have
https://chromedriver.chromium.org/downloads
建議chromedrive和測試用程式放同一個資料夾
https://ithelp.ithome.com.tw/upload/images/20201012/20119608qvIp6eQ4yM.jpg

Starting ChromeDriver 86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
pip3 install selenium
Collecting selenium
  Downloading https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl (904kB)
     |████████████████████████████████| 911kB 285kB/s
Requirement already satisfied: urllib3 in c:\python37\lib\site-packages (from selenium) (1.25.7)
Installing collected packages: selenium
Successfully installed selenium-3.141.0

test4.py

from selenium import webdriver
driver = webdriver.Chrome('./chromedriver')
driver.get("https://freelancerlife.info/") #前往這個網址
driver.close()

https://ithelp.ithome.com.tw/upload/images/20201012/20119608n8wUoeuZeF.jpg


上一篇
[Python]Natural Language Toolkit
下一篇
[C]如何寫一個 makefile
系列文
軟體開發隨筆雜記--試著解決問題33
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言