Skip to content

Take screenshot filename argument failing when registered to be run on failure #1702

Closed

Description

@tomekPawlak

Like agreed here #1396 reporting this.

Describe the bug
Take screenshot filename argument failing when registered to be run on failure:

[ WARN ] Keyword 'Take Screenshot    filename=robotframework-browser-screenshot-{index}' could not be run on failure:
take_screenshot() got multiple values for argument 'filename'

Trace log:

Traceback (most recent call last):
  File "c:\python37\lib\site-packages\Browser\browser.py", line 880, in run_keyword
    raise e
  File "c:\python37\lib\site-packages\Browser\browser.py", line 870, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "c:\python37\lib\site-packages\robotlibcore.py", line 94, in run_keyword
    return self.keywords[name](*args, **(kwargs or {}))
  File "c:\python37\lib\site-packages\Browser\keywords\waiter.py", line 93, in wait_for_elements_state
    selector, state, timeout, self.strict_mode
  File "c:\python37\lib\site-packages\Browser\keywords\waiter.py", line 132, in _wait_for_elements_state
    logger.info(response.log)
  File "c:\python37\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\python37\lib\site-packages\Browser\playwright.py", line 153, in grpc_channel
    raise AssertionError(error.details())

Working fine for positional argument.

To Reproduce
Here look at a code snippet:

Take screenshot filename argument failing when registered to be run on failure

[Setup]  New Page  https://www.yahoo.com/
Browser.Register Keyword To Run On Failure  Take Screenshot  filename=robotframework-browser-screenshot-{index}
Click  //button[@name="agree"]
Wait Until Network Is Idle
Wait For Elements State  ddd
[Teardown]  Close Page

Expected behavior
Filename argument should be processed correctly and desired filename and path should be set.

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise Version 21H2 OS build 19044.1415
  • OS: Docker image rfbrowser-stable:v11.1.1
  • Browser: Chrome Version 97.0.4692.71 (Official Build) (64-bit)

Additional context
Please find attached logs

Activity

  1. added
    bug
    on Jan 21, 2022
  2. aaltat commented on Jan 21, 2022

    @aaltat
    Member

    @allcontributors please add @tomekTieto for bugs.

  3. allcontributors commented on Jan 21, 2022

    @allcontributors
    Contributor

    @aaltat

    @tomekTieto already contributed before to bug

  4. aaltat commented on Jan 21, 2022

    @aaltat
    Member

    That should work, but looks like it doesn't.

  5. schinckel commented on Feb 14, 2022

    @schinckel

    I'm seeing what I believe is the same error on a Bitbucket Pipelines container.

  6. adrian-evo commented on Mar 30, 2022

    @adrian-evo

    There seems to be an error in the code snipped above. Adding Browser also in front of Take Screenshot it works, which means in the above code some other Take Screenshot keyword was used:

    Browser.Register Keyword To Run On Failure Browser.Take Screenshot filename=

    However, I have another problem, not sure if this should be another issue. When using the full path instead of file name, it does not work:

    Browser.Register Keyword To Run On Failure Browser.Take Screenshot filename=${OUTPUT DIR}/screenshots/failed/robotframework-browser-screenshot-{index}
    The output is:

    image

    Taking a screenshot with the same arguments, normally not on failure, it works.

  7. self-assigned this
    on Sep 17, 2023
  8. added this to the v18.0.0 milestone on Sep 17, 2023
  9. modified the milestones: v17.5.2, on Oct 13, 2023
  10. modified the milestones: , v18.1.0 on Oct 30, 2023
  11. added a commit that references this issue on Nov 19, 2023
    91b4921
  12. aaltat commented on Nov 19, 2023

    @aaltat
    Member

    This is not fixed, opening

  13. reopened this on Nov 19, 2023
  14. aaltat commented on Nov 19, 2023

    @aaltat
    Member

    Fuond the reason, code in https://github.com/MarketSquare/robotframework-browser/blob/main/Browser/browser.py#L909 is too naive and makes wrong assumption. Instead code should look argspec more closely and make better decision about argument types.

  15. added a commit that references this issue on Nov 21, 2023
    92465df
  16. added a commit that references this issue on Nov 21, 2023
    d7eab07
  17. assigned and unassigned on Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority: high

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions