Je suis en cours d'exécution d'un test en utilisant le package Chrome sans tête Puppeteer:Async lancer SyntaxError: jeton inattendu (
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()
})()
Et je suis en cours d'exécution du script: node --harmony test/e2e/puppeteer/index.js
(v6.9.1)
Mais Je reçois cette erreur:
;(async() => {
^
SyntaxError: Unexpected token (
Quel pourrait être le problème
Note: J'utilise modèle Webpack officiel de Vue CLI:
Vous trouverez peut-être utile http://node.green/. –