1. 程式人生 > >python3 安裝selenium

python3 安裝selenium

版本 chrom () get word ref gecko == port

pycharm選擇python3

技術分享圖片

安裝 pip3

python3 -m pip install -U pip

安裝seleium

pip install selenium

pip install --upgrade seleium (看版本 import seleium 、help(seleium)穩定的版本selenium ==2.48.0 、或pip install selenium==2.48.0)

下載遊覽器驅動

https://github.com/mozilla/geckodriver/releases(firefox)

https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ (ie)

http://npm.taobao.org/mirrors/chromedriver (google)

python3 爬蟲

  1. from selenium import webdriver
  2. driver = webdriver.Firefox()
  3. url = ‘http://www.baidu.com/‘
  4. driver.get(url)
  5. driver.find_element_by_id(‘kw‘).send_keys()
  6. driver.find_element_by_id("su").click()
  7. driver.quit()

python3 安裝selenium