#coding=utf-8

from selenium import webdriver
import time chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
driver=webdriver.Chrome(chrome_options=chrome_options,executable_path=r"C:\Users\wecash\AppData\Local\Google\Chrome\Application\chromedriver.exe") driver.get('https://www.baidu.com/?tn=93380420_hao_pg')
driver.find_element_by_id('kw').send_keys('测试')
time.sleep(3) driver.get_screenshot_as_file(r"C:\Users\wecash\Desktop\baidu.png")

  

官网:https://developers.google.cn/web/updates/2017/04/headless-chrome

selenium-chrome-headless的更多相关文章

  1. 笔记-selenium+chrome headless

    笔记-selenium+chrome headless 1.      selenium+chrome headless phantomjs与selenium分手了,建议使用其它无头浏览器. chro ...

  2. ubuntu服务器端使用无界面selenium+ chrome + headless

    本来想直接用Ubuntu系统里面的firefox来实现selenium自动操作签到的,但是总是出各种问题.没办法,改为Chrome.参考:Ubuntu 线上无界面服务器 使用selenium chro ...

  3. chrome浏览器爬虫WebDriverException解决采用python + selenium + chrome + headless模式

    WebDriverException: Message: unknown error: Chrome failed to start: crashed 第一种:如果出现下面情况: chrome浏览器有 ...

  4. selenium chrome headless无界面引擎

    注意:PhantomJS已被舍弃 chrome headless 在打开浏览器之前添加参数 import time import sys from selenium import webdriver ...

  5. Ubuntu 无界面使用selenium chrome + headless

    1. 安装 selenium : sudo pip install selenium 2. 安装 chromdriver: 进入 淘宝镜像源 下载 chromdriver, 可以查看 notes.tx ...

  6. Selenium + Chrome headless 报ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context 可忽略并配置不输出日志

    Selenium不再推荐使用PhantomJS,会报如下警告 UserWarning: Selenium support for PhantomJS has been deprecated, plea ...

  7. selenium +chrome headless Adhoc模式渲染网页

    mannual和adhoc模式比较 Manual vs. Adhoc In the script above, we start the ChromeDriver server process whe ...

  8. selenium +chrome headless Manual 模式渲染网页

    可以看看这个里面的介绍,写得很好.https://duo.com/blog/driving-headless-chrome-with-python from selenium import webdr ...

  9. ubuntu中如何安装selenium+chrome(headless)无界面浏览器?

    selenium是一个Web的自动化测试工具,它可以根据我们的指令,让浏览器自动加载页面,获取需要的数据,甚至页面截屏,或者判断网站上某些动作是否发生.但是它自身不带浏览器,不支持浏览器的功能,因此它 ...

  10. Selenium及Headless Chrome抓取动态HTML页面

    一般的的静态HTML页面可以使用requests等库直接抓取,但还有一部分比较复杂的动态页面,这些页面的DOM是动态生成的,有些还需要用户与其点击互动,这些页面只能使用真实的浏览器引擎动态解析,Sel ...

随机推荐

  1. Linux定时任务出现问题时正确的解决步骤

    但凡是提供服务的,都要有本账.软件服务也不例外.无论是Apache,Nginx,还是我们自己搭建的网站,日志是标配.这里的日志就是一本账. 当定时任务出现问题时,正确的处理步骤是: 1,定时任务服务是 ...

  2. JS在不同js文件中互相调用

    例如有这样一个html,里面有一个按钮,当按下时调用b.js文件中的方法b().而b()中又要调用a.js文件中的方法a().若要实现这个功能,必须注意,将要引入的Js文件代码放在</body& ...

  3. docker搭建本地仓库并制作自己的镜像

    原文地址https://blog.csdn.net/junmoxi/article/details/80004796 1. 搭建本地仓库1.1 下载仓库镜像1.2 启动仓库容器2. 在CentOS容器 ...

  4. myeclipse连接sql server2008 r2数据库

    我用的myeclipse自带的jdk1.6连接的,所以选用sqljdbc4.jar的jar包,我是win7电脑 之前也看到一些用户留的微软官方连接,但是官方那边已经取消下载了,所以我重新去找了下 链接 ...

  5. Leetcode: Binary Tree Postorder Transversal

    Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary ...

  6. 文件操作(CRT、C++、WIN API、MFC)

    一.使用CRT函数文件操作 二.使用标准C++库 std::fstream std::string 1)std::string对象内部存储了一个C的字符串,以'\0'结尾的. 2)std::strin ...

  7. python爬虫对于gb2312

    对于刚刚接触python爬虫的人,常常会碰到一个比较烦的问题, 如果网页是GB2312编码格式,我们直接decode(’GB2312‘)一般python都会报错: GB2312不能编码该页面. 这就比 ...

  8. FAFU 1395

    动态规划:...翻牌FAFU 1395 动态规划

  9. ASP.NET控件--DropDownList

      设置默认值:DropDownList1.Items[i].Selected=true;绑定:DropDownList1.DataSource = dataSet.Tables["Tabl ...

  10. python堆排序

    堆是完全二叉树 子树是不相交的 度 节点拥有子树的个数 满二叉树: 每个节点上都有子节点(除了叶子节点) 完全二叉树: 叶子结点在倒数第一层和第二层,最下层的叶子结点集中在树的左部 ,在右边的话,左子 ...