ale*_*lex 3 javascript webpack vue.js ecmascript-2017 puppeteer
我正在使用无头 Chrome 包Puppeteer运行测试:
const puppeteer = require('puppeteer')
;(async() => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://google.com', {waitUntil: 'networkidle'})
// Type our query into the search bar
await page.type('puppeteer')
await page.click('input[type="submit"]')
// Wait for the results to show up
await page.waitForSelector('h3 a')
// Extract the results from the page
const links = await page.evaluate(() => {
const anchors = Array.from(document.querySelectorAll('h3 a'))
return anchors.map(anchor => anchor.textContent)
})
console.log(links.join('\n'))
browser.close()
})()
Run Code Online (Sandbox Code Playgroud)
我正在运行脚本:node --harmony test/e2e/puppeteer/index.js(v6.9.1)
但我收到此错误:
;(async() => {
^
SyntaxError: Unexpected token (
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
注意:我使用的是 Vue CLI 的官方 Webpack 模板:
| 归档时间: |
|
| 查看次数: |
3381 次 |
| 最近记录: |