selenium 爬虫

 1 from selenium import webdriver
 2 import time
 3 
 4 driver = webdriver.PhantomJS(executable_path="D:/phantomjs/bin/phantomjs.exe")
 5 driver.get("http://study.163.com/course/courseMain.htm?courseId=1002810012")
 6 time.sleep(4)
 7 data = driver.find_element_by_id('j-coursehead').text
 8 a = data.find('\n')
 9 b = data[a + 1:].find('\n')
10 num = data[a + 1:a + 1 + b]
11 driver.quit()
12 print('网易云课堂的销量为:',num)

 

posted @ 2017-04-19 13:46  Erick-LONG  阅读(132)  评论(0编辑  收藏  举报