提交 b2fd5d1b 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

compatible phantomjs-prebult executable path

上级 a84cc666
......@@ -2,7 +2,7 @@
# Wechaty [![Circle CI](https://circleci.com/gh/zixia/wechaty.svg?style=svg)](https://circleci.com/gh/zixia/wechaty)
Wechaty is Wechat for Bot.
It's a library/framework for easy creating wechat bot in 10 lines of code.
> Easy creating wechat robot code in 10 lines.
[![Join the chat at https://gitter.im/zixia/wechaty](https://badges.gitter.im/zixia/wechaty.svg)](https://gitter.im/zixia/wechaty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://badge.fury.io/js/wechaty.svg)](https://badge.fury.io/js/wechaty)
......
......@@ -4,3 +4,10 @@ machine:
dependencies:
post:
notify:
webhooks:
# A list of hook hashes, containing the url field
# gitter hook
- url: https://webhooks.gitter.im/e/537e61e880e78bc0b271
......@@ -36,19 +36,37 @@ class Browser {
const WX_URL = 'https://wx.qq.com'
log.verbose('Browser', `init ${this.browser}:${this.port}`)
this.driver = new WebDriver.Builder().forBrowser(this.browser).build()
/*
this.driver = new WebDriver.Builder()//.forBrowser(this.browser).build()
.withCapabilities(
WebDriver.Capabilities.phantomjs()
.set('phantomjs.binary.path', 'D:\\cygwin64\\home\\zixia\\git\\wechaty\\node_modules\\phantomjs-prebuilt\\lib\\phantom\\bin\\phantomjs.exe')
).build()
*/
this.driver = this.getDriver()
return this.driver.get(WX_URL)
}
getDriver() {
var driver
switch(this.browser) {
case 'phantomjs':
driver = getPhantomJsPreBuilt()
break
default:
driver = new WebDriver.Builder().forBrowser(this.browser).build()
break
}
return driver
function getPhantomJsPreBuilt() {
// https://github.com/SeleniumHQ/selenium/issues/2069
//setup custom phantomJS capability
const phantomjs_exe = require('phantomjs-prebuilt').path
var customPhantom = selenium.Capabilities.phantomjs()
.set("phantomjs.binary.path", phantomjs_exe)
//build custom phantomJS driver
return new selenium.Builder()
.withCapabilities(customPhantom)
.build()
}
}
getInjectio() {
return fs.readFileSync(
path.join(path.dirname(__filename), 'puppet-web-injectio.js')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册