参考:https://www.cnblogs.com/LanTianYou/p/5578621.html

# coding:utf8
from time import sleep
from selenium import webdriver
import json class Hiblog(object):
def __init__(self, url1):
self.url = url1 def screen_shot(self):
driver = webdriver.PhantomJS()
driver.get(self.url)
driver.find_element_by_name("username").send_keys("admin")
driver.find_element_by_name("password").send_keys("admin")
driver.find_element_by_xpath("//button[@type='submit']").click()
driver.viewportSize = {'width': 1024, 'height': 800}
driver.maximize_window()
sleep(5)
driver.save_screenshot('test.png')
print(driver.title) if __name__ == "__main__":
url = "http://www.baidu.com"
screen = Hiblog(url)
screen.screen_shot()

PhantomJS python 截屏的更多相关文章

  1. 使用laravel框架与phantomjs实现截屏功能

    在网上看到的关于phantomjs实现截屏功能很多都是与node结合在一起使用,并需要输入命令才能执行.因此我想要实现输入网址即可截屏并输出图片的功能.示例:http://120.77.171.182 ...

  2. Python: 截屏

    最近项目中想实现截屏功能,使用的笔记本是高清屏,实际屏幕设置成了150%,所以在截屏的时候遇到个各种问题. 最开始使用PIL ImageGrab来截取屏幕,如果本来是100%的设置没有问题,能截取到全 ...

  3. No.12 selenium for python 截屏

    一.selenium for python 提供的几种截图方法 从上至下,很容易理解 1.as_file 获取当前window的截图,参数filename则表示截图的路径以及名称 出现IOError时 ...

  4. python 截屏操作

    方法1: 用pyscreenshot,https://pypi.org/project/pyscreenshot/ 方法2:用autopy,https://pypi.org/project/autop ...

  5. nodejs+phantomjs+七牛 实现截屏操作并上传七牛存储

    近来研究了下phantomjs,只是初涉,还谈不上深入研究,首先介绍下什么是phantomjs. 官网上的介绍是:”PhantomJS is a headless WebKit scriptable ...

  6. PhantomJS linux系统下安装步骤及使用方法(网页截屏功能)

    PhantomJS 是一个基于 WebKit 的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, CSS 选择器, JSON, ...

  7. Python 实现网页截屏、查库、发邮件

    本文介绍了使用 Python(2.7版本)实现网页截屏.查库.发邮件的 demo.用到了 selenium.phantomjs.mailer.jinja2.mysqldb 还有 image,都是比较典 ...

  8. 使用Python中PIL图形库进行截屏

    目的:通过使用Python的一个图形库PIL(Python Image Library)对屏幕进行截图 步骤: 1.下载PIL(路径)并安装 2.新建文件“截屏.py”,右键Edit with IDL ...

  9. 利用PhantomJS进行网页截屏,完美解决截取高度的问题

    关于PhantomJS PhantomJS 是一个基于WebKit的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, CSS ...

随机推荐

  1. 主攻ASP.NET MVC4.0之重生:ASP.NET MVC Web API

    UserController代码: using GignSoft.Models; using System; using System.Collections.Generic; using Syste ...

  2. 优美的英文诗歌Beautiful English Poetry

    <When you are old>——<当你老了> --- William Butler Yeats ——威廉·巴特勒·叶芝When you are old and grey ...

  3. INSPIRED启示录 读书笔记 - 第29章 大公司如何创新

    大公司实现创新的方法 20%法则:谷歌的程序员有20%的工作时间可以用来从事创新研究,这个方法最早是从施乐帕克研究所学来的.20%法则鼓励普通员工自己尝试各种想法,让员工打心底愿意倾注更多的激情和汗水 ...

  4. 网络安全-跨站脚本攻击XSS(Cross-Site Scripting)

    一.XSS攻击简介 作为一种HTML注入攻击,XSS攻击的核心思想就是在HTML页面中注入恶意代码,而XSS采用的注入方式是非常巧妙的. 在XSS攻击中,一般有三个角色参与:攻击者.目标服务器.受害者 ...

  5. thinkphp URL 模式

    兼容ThinkPHP三种url模式的nginx rewrite location / { root /var/www; index index.html index.htm index.php; if ...

  6. 泛型学习第四天——List泛型终结:什么是List泛型,泛型筛选,泛型排序

    为什么要用泛型集合? 在C# 2.0之前,主要可以通过两种方式实现集合: a.使用ArrayList 直接将对象放入ArrayList,操作直观,但由于集合中的项是Object类型,因此每次使用都必须 ...

  7. 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0” 提供程序

    我在Web App程序里面用“Microsoft.Jet.OLEDB.4.0”来连接Excel文件,导入到数据库,在Windows 2003+ Office 2007 的环境下正常,但是在Window ...

  8. VC 模拟CMD 匿名管道

    #include "stdafx.h" #include <Windows.h> #include <stdio.h> #include <stdli ...

  9. 解决Pycharm中matplotlib画图出错问题(AttributeError: module 'matplotlib' has no attribute 'verbose')

    最近在Linux中使用pycharm过程中使用matplotlib无法画图,总是提示错误 /usr/bin/python3. /home/leo/PycharmProjects/untitled1/E ...

  10. 智课雅思词汇---十九、前缀se是什么意思

    智课雅思词汇---十九.前缀se是什么意思 一.总结 一句话总结:前缀:se- 表示“分开, 离开, 区别开” 前缀:se- [词根含义]:分离 [同源单词]:secede, secession, s ...