robotframework-browser icon indicating copy to clipboard operation
robotframework-browser copied to clipboard

Wait For Promise interferes with taking screenshots on Click failure

Open dgalezow opened this issue 3 years ago • 2 comments

Describe the bug When waiting for a response after clicking the button there is no screenshot of page where error occurred. Instead Take Screenshot have a description of the error that occurred on the Click keyword

To Reproduce

*** Settings ***
Library    Browser

Suite Setup    Register Keyword To Run On Failure    Fail Screenshot

*** Test Cases ***
Click Disabled Button
    [Tags]    current
    New Page    https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_disabled
    ${promise}=     Promise To    Wait For Response    thereisnospoon
    Click    //div[@id="accept-choices"]
    Click    //button[@type="button"]   
    Wait For    ${promise}


*** Keywords ***
Fail Screenshot
    ${current-url}=    Get Url
    Log    ${TEST NAME} encountered error on ${current-url}    WARN
    Take Screenshot    ${OUTPUTDIR}/screenshots/browser/rf-browser-${TEST NAME}-{index}    fullPage=True

Expected behavior Take Screenshot should take screenshots if possible :)

Screenshots image

Desktop:

  • OS: Windows 10
  • Browser chromium
  • robotframework 4.1.3
  • robotframework-browser 12.2.0

dgalezow avatar May 11 '22 09:05 dgalezow

I probably have the same issue in my docker container. The button 'Sign In' is found but cannot be clicked and screenshot isn't taken.

Versions: Ubuntu 20.04.2 LTS robotframework-browser 12.3.0 robotframework 5.0.1 Python 3.8.10 npm 6.14.16

Error in playwright-log.txt: {"level":30,"time":"2022-05-23T07:09:51.329Z","pid":66,"hostname":"runner-3xa35wsf-project-172060-concurrent-0pbhsn","msg":"Start of node method click"} {"level":30,"time":"2022-05-23T07:09:51.329Z","pid":66,"hostname":"runner-3xa35wsf-project-172060-concurrent-0pbhsn","msg":"Strict mode is enabled, find Locator with 'Sign In' in page."} 2022-05-23T07:09:51.330Z pw:api => locator.click started 2022-05-23T07:09:51.330Z pw:api waiting for selector "'Sign In'" 2022-05-23T07:09:51.333Z pw:api selector resolved to visible <input tabindex="4" name="login" id="kc-login" type="su…/> 2022-05-23T07:09:51.335Z pw:api attempting click action 2022-05-23T07:09:51.335Z pw:api waiting for element to be visible, enabled and stable 2022-05-23T07:09:51.810Z pw:api "networkidle" event fired 2022-05-23T07:10:01.333Z pw:api <= locator.click failed {"level":30,"time":"2022-05-23T07:10:01.333Z","pid":66,"hostname":"runner-3xa35wsf-project-172060-concurrent-0pbhsn","msg":"Error of node method click"} ================= Original suppressed error ================= locator.click: Timeout 10000ms exceeded. =========================== logs =========================== waiting for selector "'Sign In'" selector resolved to visible <input tabindex="4" name="login" id="kc-login" type="su…/> attempting click action waiting for element to be visible, enabled and stable

at click (/usr/local/lib/python3.8/dist-packages/Browser/wrapper/index.js:6955:17)
at async PlaywrightServer.click (/usr/local/lib/python3.8/dist-packages/Browser/wrapper/index.js:7757:28) {

name: 'TimeoutError' }

{"level":30,"time":"2022-05-23T07:10:01.338Z","pid":66,"hostname":"runner-3xa35wsf-project-172060-concurrent-0pbhsn","msg":"Start of node method takeScreenshot"} 2022-05-23T07:10:01.338Z pw:api => page.screenshot started 2022-05-23T07:10:11.348Z pw:api <= page.screenshot failed {"level":30,"time":"2022-05-23T07:10:11.348Z","pid":66,"hostname":"runner-3xa35wsf-project-172060-concurrent-0pbhsn","msg":"Error of node method takeScreenshot"} ================= Original suppressed error ================= page.screenshot: Timeout 10000ms exceeded. at takeScreenshot (/usr/local/lib/python3.8/dist-packages/Browser/wrapper/index.js:6319:16) at PlaywrightServer.takeScreenshot (/usr/local/lib/python3.8/dist-packages/Browser/wrapper/index.js:7757:34) at handleUnary (/usr/local/lib/python3.8/dist-packages/Browser/wrapper/node_modules/@grpc/grpc-js/build/src/server.js:718:13) { name: 'TimeoutError' }

If this should be another bug report please give feedback.

franky1964 avatar May 24 '22 11:05 franky1964

Having the same problem. No screenshot when failure happens while waiting for promise

emakaay avatar Oct 11 '22 18:10 emakaay

I checked again and it is fixed in 17.5.2.

Snooz82 avatar Nov 11 '23 19:11 Snooz82