python爬虫之路——无头浏览器初识及简单例子

 

 

 

 

from selenium import webdriver
url='https://www.jianshu.com/p/a64529b4ccf3'
def get_info(url):
    include_title=[]
    driver=webdriver.PhantomJS()
    driver.get(url)
    driver.implicitly_wait(20)
    author=driver.find_element_by_xpath('/html/body/div[1]/div[1]/div[1]/div[1]/div/span/a').text
    print(author)
get_info(url)

 

 

 

 

posted @ 2018-04-23 10:34  蓝勃斐重新开始  阅读(3059)  评论(0编辑  收藏  举报