python chrome的自定义启动
# encoding:utf-8 """
@version: python27
@author: fafa
@site: http://www.phpgao.com
@software: PyCharm Community Edition
@file: chromeserver.py
@time: 2018/7/29 0029 下午 5:24
"""
import time
from selenium import webdriver class ChromeServerParse(object):
def __init__(self):
# chromedriver的路径
self.excute_path = "D:\\Python\\Python37\\Scripts\\chromedriver.exe"
# 指定chromedriver启动的端口
self.port = 8080
# 指定chromedriver service 启动的参数
self.service_args = ["lang=zh_CN.UTF-8", "--start-maximized", '--disable-infobars']
self.option = webdriver.ChromeOptions()
# 设置字符编码
self.option.add_argument("lang=zh_CN.UTF-8")
# 窗口最大化
self.option.add_argument("start-maximized")
# 隐身模式
self.option.add_argument("incognito")
# 阻止弹出框
self.option.add_argument('disable-infobars') def start_chromedriver(self):
self.driver = webdriver.Chrome(
executable_path=self.excute_path,
port=self.port,
service_args=self.service_args,
chrome_options=self.option)
driver = self.driver
driver.get("http://www.baidu.com")
time.sleep(5) if __name__ == '__main__':
ChromeServerParse().start_chromedriver()
python chrome的自定义启动的更多相关文章
- Windows下的Jupyter Notebook 安装与自定义启动(图文详解)
不多说,直接上干货! 前期博客 Windows下的Python 3.6.1的下载与安装(适合32bits和64bits)(图文详解) 这是我自定义的Python 的安装目录 (D:\SoftWare\ ...
- Windows下的Jupyter Notebook 安装与自定义启动
1.Jupyter Notebook 和 pip 为了更加方便地写 Python 代码,还需要安装 Jupyter notebook. 利用 pip 安装 Jupyter notebook. 为什么要 ...
- Selenium Chrome浏览器的启动以及proxy设置
Selenium Chrome浏览器的启动以及proxy设置 虽然WebDriver对Firefox的支持最好,之前写的脚本也都在Firefox浏览器运行,但最近项目做了整合,发现新整合的功能不太 ...
- seleniu+python+chrome的调试
1.下载chrome,下载chrome driver,下载地址:http://code.google.com/p/chromedriver/downloads/list 2.安装chrome,默认路径 ...
- 重新想象 Windows 8 Store Apps (69) - 其它: 自定义启动屏幕, 程序的运行位置, 保持屏幕的点亮状态, MessageDialog, PopupMenu
[源码下载] 重新想象 Windows 8 Store Apps (69) - 其它: 自定义启动屏幕, 程序的运行位置, 保持屏幕的点亮状态, MessageDialog, PopupMenu 作者 ...
- chrome浏览器插件启动本地应用程序
chrome浏览器插件启动本地应用程序 2014-04-20 00:04:30| 分类: 浏览器插件|举报|字号 订阅 下载LOFTER我的照片书 | chrome的插件开发这里就 ...
- python 的几种启动方式
python 的几种启动方式 (1)利用Win的操作系统的:命令行工具 cmd.exe Win + R 调出运行对话框,然后输入cmd,即可调出“命令提示符对话框” 或者 在菜单中店家附件中的命令提 ...
- python+selenium之自定义封装一个简单的Log类
python+selenium之自定义封装一个简单的Log类 一. 问题分析: 我们需要封装一个简单的日志类,主要有以下内容: 1. 生成的日志文件格式是 年月日时分秒.log 2. 生成的xxx.l ...
- SpringBoot2.0 基础案例(17):自定义启动页,项目打包和指定运行环境
本文源码 GitHub地址:知了一笑 https://github.com/cicadasmile/spring-boot-base 一.打包简介 springboot的打包方式有很多种.可以打war ...
随机推荐
- (生活)Photoshop入门(不定时更新)
我可能是想找个工作以外的事情做一下. 目标:我要自学网PhotoShop商业修图. 笔记: .图层 .1总结: 1.1.1图层就好像画画的一张纸,但是每一层又互不影响. 1.1.2图层蒙版(覆盖一层玻 ...
- Flink Pre-defined Timestamp Extractors / Watermark Emitters(预定义的时间戳提取/水位线发射器)
https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/event_timestamp_extractors.html 根据官网 ...
- canvas save()和canvas restore()状态的保存和恢复使用方法及实例
canvas.save()用来保存先前状态的 canvas.restore()用来恢复之前保存的状态 注:两种方法必须搭配使用,否则没有效果 <!DOCTYPE html> <htm ...
- uiautomator2 使用Python测试 Android应用
GitHub地址:https://github.com/openatx/uiautomator2 介绍 uiautomator2 是一个可以使用Python对Android设备进行UI自动化的库.其底 ...
- 混合编程[python+cpp+cuda]
很多时候,我们是基于python进行模型的设计和运行,可是基于python本身的速度问题,使得原生态python代码无法满足生产需求,不过我们可以借助其他编程语言来缓解python开发的性能瓶颈.这里 ...
- ibatisNet MERGE INTO ORA-00911: 无效字符
在sql工具中测试正常,放到代码中出现 “ORA-00911: 无效字符” 错误时,请检查sql语句是否有分号.
- 工具(3): 转换Excel表格到MarkDown:exceltk
源码和下载: 0.1.3 mac: https://github.com/fanfeilong/exceltk/blob/master/pub/exceltk.0.1.3.pkg windows: h ...
- 【学习总结】GirlsInAI ML-diary day-8-list列表
[学习总结]GirlsInAI ML-diary 总 原博github链接-day8 认识list列表 新的数据类型:list. list是一种有序的集合,可以随时添加和删除其中的元素(链表??) 1 ...
- css3 animation(左右摆动) (放大缩小)
左右摆动: @-webkit-keyframes roundRule{ 0%, 100%{ -webkit-transform: rotate(-15deg); } 50%{ -webkit-tran ...
- C# Note37: Writing unit tests with use of mocking
前言 What's mocking and its benefits Mocking is an integral part of unit testing. Although you can run ...