【文件属性】:
文件名称:Chrome酸盐:自动化无头Chrome
文件大小:27KB
文件格式:ZIP
更新时间:2021-01-31 05:18:04
chrome phantomjs chrome-headless ChromeJavaScript
自动化-启动/停止Chrome实例,打开和关闭标签页,并与目标页面进行通信。
兼容性
您必须使用> = 59的Chrome版本(当前表示 )或使用 。
Linux平台不支持Canary。
安装
npm install chromate
npm run sample
利用
let { Chrome , Tab } = require ( 'chromate' ) ;
// start a headless Chrome process
Chrome . start ( ) . then ( chrome => {
let tab = new Tab ( {
verbose : true ,
failonerror : false
} ) ;
tab . open ( targetUrl )
. then ( ( ) => tab . evaluate ( 'testResults' ) )
. then ( res => console . log ) // results...
. then ( ( ) => tab . close ( ) )
【文件预览】:
chromate-master
----api.md(16KB)
----src()
--------chrome-tab.js(16KB)
--------chrome-proc.js(11KB)
----LICENSE(1KB)
----test()
--------fixtures()
--------chrome-tab.spec.js(13KB)
--------chrome-proc.spec.js(2KB)
----README.md(8KB)
----sample()
--------main.js(2KB)
--------target.html(1KB)
----.gitignore(23B)
----index.js(148B)
----bin()
--------cli.js(2KB)
----package.json(675B)