美文网首页
python使用selenium无界面浏览器

python使用selenium无界面浏览器

作者: 我心有猛虎2018 | 来源:发表于2019-01-22 00:18 被阅读0次
#coding=utf-8
import selenium
import selenium.webdriver
import time

path = r"D:\Program Files\phantomjs-2.1.1-windows\bin\phantomjs.exe"
webdriver = selenium.webdriver.PhantomJS(path)
webdriver.get('https://baidu.com')
time.sleep(3)
webdriver.save_screenshot('baidu.jpg')
print(webdriver.page_source)
webdriver.quit()

相关文章

网友评论

      本文标题:python使用selenium无界面浏览器

      本文链接:https://www.haomeiwen.com/subject/deekjqtx.html