selenium chrome python 资料

http://blog.csdn.net/huilan_same/article/details/51896672  # 历史chrome版本 与 chromedriver 之间的对应

http://chromedriver.storage.googleapis.com/index.html  # chromedriver 下载地址

https://www.slimjet.com/chrome/google-chrome-old-version.php # 历史各版本chrome浏览器下载

http://ftp.mozilla.org/pub/firefox/releases/ # 历史个版本Firefox 下载

update by 2018/2/24

------------------无界面启动例子----------------------------

 

from selenium import webdriver as sweb
from selenium.webdriver.chrome.options import Options
option = Options()
option.add_argument("--headless") # 无界面启动参数
option.binary_location = (r"C:\Users\test\AppData\Local\Google\Chrome\Application\chrome.exe")

abspath = os.path.abspath(r"E:\chromedriver.exe") # 必须要指定driver 路径 或者配置环境变量
d = sweb.Chrome(chrome_options=option, executable_path=abspath)
d.get("http://www.jd.com")
print(d.page_source)
print(d.current_url)
d.quit()
--------------添加代理的方法-----------------------------
from selenium import webdriver
PROXY = "proxy_host:proxy:port"
options = webdriver.ChromeOptions()
desired_capabilities = options.to_capabilities()
desired_capabilities[proxy‘] = {
    "httpProxy":PROXY,
    "ftpProxy":PROXY,
    "sslProxy":PROXY,
    "noProxy":None,
    "proxyType":"MANUAL",
    "class":"org.openqa.selenium.Proxy",
    "autodetect":False
}
driver = webdriver.Chrome(desired_capabilities = desired_capabilities)

chrome 启动参数列表
参数:--user-data-dir=UserDataDir
用途:自订使用者帐户资料夹(如:–user-data-dir="D:\temp\Chrome User Data")
参数:--start-maximized
用途:启动就最大化
参数:--no-sandbox
用途:取消沙盒模式
参数:--single-process
用途:单进程(程序、执行绪)运行
参数:--process-per-tab
用途:每个分页使用单独进程
参数:--process-per-site
用途:每个站点使用单独进程
参数:--in-process-plugins
用途:插件不启用单独进程
参数:--disable-popup-blocking
用途:禁用弹出拦截
参数:--disable-javascript
用途:禁用JavaScript
参数:--disable-java
用途:禁用Java
参数:--disable-plugins
用途:禁用插件
参数:–disable-images
用途:禁用图像
参数:--incognito
用途:启动后直接进入直接无痕浏览(隐身模式)
参数:--omnibox-popup-count=”num”
用途:将网址列弹出的提示选单数量改为num个
参数:--disk-cache-size
用途:设置cache文件的大小,如最大值为40MB, 则可添加参数 --disk-cache-size=41943040
参数:--disk-cache-dir
用途:设定缓存存放路径,可以自行设定到高速磁盘(ramdisk),例如:--disk-cache-dir="Z:",不过个人感觉速度没有增快
参数:--enable-vertical-tabs
用途:调整chrome游览器标签存放在左边,非顶部
–purge-memory-button
--enable-internal-flash
地址栏功能:
about:version - 显示当前版本 也可以是chrome-resource://about/
about:plugins - 显示已安装插件,Google Chrome支持Active X!
about:histograms - 显示历史记录
about:dns - 显示DNS状态
about:cache, 重定向到 view-cache: 显示缓存页面
view-cache:stats - 缓存状态
about:stats - 显示状态
about:network - 很酷的网络工具
about:internets - 这应该算是一个彩蛋
chrome-resource://new-tab/ - 新标签页
about:memory - 可以查看内存和进程占用。也可以Shift+ESC,点击Statistics for nerds(傻瓜统计信息)
 
update by 2018/2/24

posted on 2018-02-24 14:45  0o0o0o0o0o000  阅读(170)  评论(0编辑  收藏  举报

导航