2017-11-09 1 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을 같은데요.

다음은 전체 오류 메시지입니다 :

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 객체를 주입/쌓여 있기 때문입니다. 페이지 작성자라고 가정하면 Promise 개체가 없을 때만 폴리필 채우기를 시도해 볼 수 있습니다. 그게 아니라 도우미 문제 (여기를 참조하십시오 : https://github.com/GoogleChrome/puppeteer/issues/1343)

+0

나는 수표를 드리겠습니다, 나는 웹 페이지의 작성자가 아니었지만 그것은 내 회사에서 관리합니다. –