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

fix test

上级 cbb57e28
......@@ -30,7 +30,7 @@ install:
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then export DISPLAY=':99.0'; fi
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then sh -e /etc/init.d/xvfb start; fi
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then sudo apt-get update; fi
# - if [ "$TRAVIS_OS_NAME" == 'linux' ]; then sudo apt-get update; fi
# - if [ "$TRAVIS_OS_NAME" == 'linux' ]; then sudo apt-get install -y libappindicator1 fonts-liberation; fi
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb; fi
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then sudo dpkg -i google-chrome*.deb; fi
......
......@@ -102,36 +102,37 @@ export class BrowserDriver {
const customChrome = Capabilities.chrome()
.set('chromeOptions', options)
return new Builder()
.setAlertBehavior('ignore')
.forBrowser('chrome')
.withCapabilities(customChrome)
.build()
// return new Builder()
// .setAlertBehavior('ignore')
// .forBrowser('chrome')
// .withCapabilities(customChrome)
// .build()
/**
* XXX when will Builder().build() throw exception???
*/
// let driver
// let ttl = 3
// let err
// while (!driver && ttl--) {
// try {
// driver = new Builder()
// .setAlertBehavior('ignore')
// .forBrowser('chrome')
// .withCapabilities(customChrome)
// .build()
// } catch (e) {
// log.warn('PuppetWebBrowserDriver', 'getChromeDriver() exception: %s, retry ttl: %d', e.message, ttl)
// err = e
// }
// }
let driver: WebDriver|null = null
let ttl = 3
let err = new Error('unknown')
// if (driver) {
// return driver
// }
while (!driver && ttl--) {
try {
driver = new Builder()
.setAlertBehavior('ignore')
.forBrowser('chrome')
.withCapabilities(customChrome)
.build()
} catch (e) {
log.warn('PuppetWebBrowserDriver', 'getChromeDriver() exception: %s, retry ttl: %d', e.message, ttl)
err = e
}
}
if (!driver) {
log.error('PuppetWebBrowserDriver', 'getChromeDriver() exception: %s, retry ttl: %d', err.stack, ttl)
throw err
}
// throw err
return driver
}
private getPhantomJsDriver(): WebDriver {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册