Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reportportal.listener don't transfer screenshots provided by Browser library #191

Open
IlkkaKoskinen opened this issue Jun 7, 2024 · 3 comments

Comments

@IlkkaKoskinen
Copy link

To communicate with GUI we are using Browser library instead of SeleniumLibrary. When some error occurs, Browser library (like SeleniumLibrary) takes a screenshot about GUI, stores it into image file and links image file into Robot Framework log file.
Everything works fine locally, but when the whole bunch is transferred into ReportPortal by using robotframework_reportportal.listener -component, image files are dropped out and only dead links remain in the log file.

I assume that the core reason for the problem is the location of screenshots files, because Browser library stores them into path ./browser/screenshots while at SeleniumLibrary time the path was something different (unfortunately I can't remember it exactly any more)

If my assumption is correct, is anybody able to add support also for screenshots of Browser library into reportportal.listener?

@petr-kus
Copy link

Generally, your problem is links that are relative to HTML report location. I have a similar problem with different libraries. I already asked for the right solution in the Robot Framework forum.

Nobody answers me to now. You have generally two possible solutions.

  1. One is to change the links of the images to the absolute path (it will lead from the report portal to somewhere to your storage of results)
  2. upload images "manually" - rewrap Browser Library keywords/methods and put there a code in python that send attachment to the report portal...

2 - has code similar to:
code
from page robotframework-reportportal

The way 2 for screenshot library:
I did it for the screenshot library where is one keyword named Take Screenshot - I created my keyword Take Screenshot. I put it in the execution order in RF as a priority to call my Take Screenshot and inside I recall Take Screenshot from the screenshot library... and take the image and upload it as an attachment to report portal.

RF test:
test

Rewrap in python:
rewrap

@petr-kus
Copy link

By the way, I understand the idea and will automate way one or two.

Currently, I am writing a listener for RF that parses log messages. When it finds an image or link, it will update/upload the relevant items to the report portal. This functionality could be integrated into the report portal listener by default - maybe I will contribute this to the report portal listener. (this will solve the situation for all libs that attach something to logs... )

@keef78
Copy link

keef78 commented Jun 17, 2024

To communicate with GUI we are using Browser library instead of SeleniumLibrary. When some error occurs, Browser library (like SeleniumLibrary) takes a screenshot about GUI, stores it into image file and links image file into Robot Framework log file. Everything works fine locally, but when the whole bunch is transferred into ReportPortal by using robotframework_reportportal.listener -component, image files are dropped out and only dead links remain in the log file.

I assume that the core reason for the problem is the location of screenshots files, because Browser library stores them into path ./browser/screenshots while at SeleniumLibrary time the path was something different (unfortunately I can't remember it exactly any more)

If my assumption is correct, is anybody able to add support also for screenshots of Browser library into reportportal.listener?

you can name your screenshot as EMBED :

https://marketsquare.github.io/robotframework-browser/Browser.html#Take%20Screenshot :
If filename equals to EMBED (case insensitive) or ${NONE}, then screenshot is embedded as Base64 image to the log.html:

than it works ans screenshot is embedded into the RP failed keyword context. like resource config and kw config:

***Settings***
Library             Browser   run_on_failure=Take Screenshot

*** Keywords***
Take Screenshot    filename=EMBED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants