close
anaconda安裝用Selenium
主要是因為爬蟲沒辦法直接看到JS的渲染
from selenium import webdriver
driver = webdriver.PhantomJS(executable_path=r'C:\Users\USER\Desktop\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin\phantomjs.exe') # PhantomJs
driver.get('http://pala.tw/js-example/') # 輸入範例網址,交給瀏覽器
pageSource = driver.page_source # 取得網頁原始碼
print(pageSource)
driver.close() # 關閉瀏覽器
全站熱搜