Debugging a failed Promise to Upload File

I’m evaluating Robot Framework and the Browser Library, and running into an issue with file uploads. Using the Promise to Upload File keyword prevents the file chooser dialog from appearing, so it’s doing something, but the keyword still times out. For context, here’s the relevant snippet from my .robot file:

    Click    "General Settings"
    ${promise}=    Promise To Upload File    ${FIRMWARE}
    Click    "Start Upgrade"
    Click    "Upload Firmware Upgrade"
    Wait For    ${promise}
    Wait For Elements State    img.loading-image    visible    30 seconds

Here, clicking “Start Upgrade” presents a modal dialog with a drag-and-drop target and a hidden <input> element, and clicking “Upload Firmware Upgrade” summons a file selection dialog.

This fails at Wait For ${promise} with the message TimeoutError: fileChooser.setFiles: elementHandle.setInputFiles: Timeout 10000ms exceeded. Enabling the Playwright log provides the corresponding excerpt:

2021-05-28T05:06:35.147Z pw:api => page.click started
2021-05-28T05:06:35.153Z pw:api waiting for selector ""Start Upgrade""
2021-05-28T05:06:35.165Z pw:api => page.waitForEvent started
2021-05-28T05:06:35.180Z pw:api waiting for event "filechooser"
2021-05-28T05:06:35.557Z pw:api   navigated to "http://172.26.6.116/#/settings"
2021-05-28T05:06:35.688Z pw:api   selector resolved to visible <button _ngcontent-lrg-c110="" class="btn btn-enatel col…>…</button>
2021-05-28T05:06:36.060Z pw:api attempting click action
2021-05-28T05:06:36.063Z pw:api   waiting for element to be visible, enabled and stable
2021-05-28T05:06:36.438Z pw:api   element is visible, enabled and stable
2021-05-28T05:06:36.441Z pw:api   scrolling into view if needed
2021-05-28T05:06:36.483Z pw:api   done scrolling
2021-05-28T05:06:36.504Z pw:api   checking that element receives pointer events at (873,360.84)
2021-05-28T05:06:36.535Z pw:api   element does receive pointer events
2021-05-28T05:06:36.541Z pw:api   performing click action
2021-05-28T05:06:36.653Z pw:api   click action done
2021-05-28T05:06:36.657Z pw:api   waiting for scheduled navigations to finish
2021-05-28T05:06:36.667Z pw:api   navigations have finished
2021-05-28T05:06:36.670Z pw:api <= page.click succeeded
2021-05-28T05:06:36.693Z pw:api => page.click started
2021-05-28T05:06:36.699Z pw:api waiting for selector ""Upload Firmware Upgrade""
2021-05-28T05:06:36.762Z pw:api   selector resolved to visible <button _ngcontent-lrg-c65="" class="btn btn-enatel"> Upload Firmware Upgrade </button>
2021-05-28T05:06:36.803Z pw:api attempting click action
2021-05-28T05:06:36.806Z pw:api   waiting for element to be visible, enabled and stable
2021-05-28T05:06:36.850Z pw:api   element is visible, enabled and stable
2021-05-28T05:06:36.852Z pw:api   scrolling into view if needed
2021-05-28T05:06:36.855Z pw:api   done scrolling
2021-05-28T05:06:36.863Z pw:api   checking that element receives pointer events at (757.42,475.12)
2021-05-28T05:06:36.874Z pw:api   element does receive pointer events
2021-05-28T05:06:36.878Z pw:api   performing click action
2021-05-28T05:06:36.908Z pw:api   click action done
2021-05-28T05:06:36.911Z pw:api   waiting for scheduled navigations to finish
2021-05-28T05:06:36.920Z pw:api   navigations have finished
2021-05-28T05:06:36.927Z pw:api <= page.click succeeded
2021-05-28T05:06:36.948Z pw:api <= page.waitForEvent succeeded
2021-05-28T05:06:36.950Z pw:api => fileChooser.setFiles started
2021-05-28T05:06:36.957Z pw:api => elementHandle.setInputFiles started
2021-05-28T05:06:47.349Z pw:api <= elementHandle.setInputFiles failed
2021-05-28T05:06:47.352Z pw:api <= fileChooser.setFiles failed
================= Original suppressed error =================
fileChooser.setFiles: elementHandle.setInputFiles: Timeout 10000ms exceeded.
Error
    at Object.captureStackTrace (C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\utils\stackTrace.js:50:19)
    at Connection.sendMessageToServer (C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\client\connection.js:65:48)
    at Proxy.<anonymous> (C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\client\channelOwner.js:64:61)
    at C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\client\elementHandle.js:173:27
    at async ElementHandle._wrapApiCall (C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\client\channelOwner.js:77:28)
    at async Page._wrapApiCall (C:\Users\Hugh.Manning\AppData\Local\Programs\Python\Python39\lib\site-packages\Browser\wrapper\node_modules\playwright\lib\client\channelOwner.js:77:28) {
  name: 'TimeoutError'
}

My best understanding is that Playwright is responding to the filechooser event (as documented in their input and page documentation), but I don’t know why it’s timing out or how to get more information. The fact that the file chooser dialog doesn’t pop up suggests to me that Playwright is handling the event, but not behaving as expected.

Have I made a mistake somewhere? Where to investigate next? Is it possible to start stepping into the javascript on the node.js side?

If it helps, the equivalent snippet of SeleniumLibrary code works just fine:

    Click Button    //app-settings/div/div[2]/div[2]/div[3]/div[2]/div/div[4]/button
    Choose File     //input[@type="file"]     ${FIRMWARE}
    Wait Until Page Contains Element    css:img.loading-image    30 seconds