2017-11-09 9 views
0

ではないがここに私のコードです:人形遣い - Promise.resolveが機能

try { 
    await page.goto(url) 
    var frame = await page.frames()[0]; 
    // iframe isn't present from the beginning (for whatever reason) 
    await page.waitFor("iframe") 
    var child = frame.childFrames()[0] 
    // wait for the image cut block to be visible 
    await child.waitFor("section[data-type=imagecut]", {timeout: 60000}) 
    // open the image cut 
    let section = await child.$("section[data-type=imagecut] h1") 
    await section.click() 
    let elements = await child.$$("section[data-type=imagecut] fieldset div a") 
    for (let element of elements) 
    { 
     await element.click() 
     console.log('click'); 
     await child.waitFor("table.boxy-wrapper") 
     console.log('wait for table'); 
     let file_upload = await child.$("input[name=file_upload]") 
     await file_upload.uploadFile(file) 
     console.log('uploaded'); 
     await child.waitFor("table.boxy-wrapper", { hidden: true }) 
     console.log('waited'); 
    } 
} catch (e) { 
    console.trace(e); 
} 

「クリック」のメッセージがログに記録されているので、私はそれがawait child.waitForだ推測しているの後にそれが失敗しています。ページの可能性が高い独自のPromiseオブジェクトを注入/いじりされているため、これがある

Trace: Error: Evaluation failed: TypeError: Promise.resolve is not a function 
    at pollMutation (<anonymous>:18:22) 
    at waitForPredicatePageFunction (<anonymous>:8:11) 
    at <anonymous>:70:3 
    at ExecutionContext.evaluateHandle (/Users/a.lau/Projects/chrome-headless/node_modules/puppeteer/lib/ExecutionContext.js:54:15) 
    at <anonymous> 
    at process._tickCallback (internal/process/next_tick.js:188:7) 
    at Object.module.exports.test (/Users/a.lau/Projects/chrome-headless/test.js:306:17) 
    at <anonymous> 
    at process._tickCallback (internal/process/next_tick.js:188:7) 

答えて

0

はここで完全なエラーメッセージです。あなたがページの作者であると仮定すると、Promiseオブジェクトが存在しないときにポリフィリングのみを試してみるかもしれません。それ以外のことはpuppeterの問題です(https://github.com/GoogleChrome/puppeteer/issues/1343参照)

+0

私は小切手を持っています。私はウェブページの作成者ではなく、私の会社によって管理されています。 –

関連する問題