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

Return base64 image in case of EMBED #1923

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hsj51
Copy link

@hsj51 hsj51 commented Oct 7, 2024

This can be useful in case if someone wants to reuse the image i.e set test message or set suite documentation

This can be useful in case if someone wants to reuse the image i.e set test message or set suite documentation
@emanlove
Copy link
Member

emanlove commented Oct 8, 2024

@hsj51 Could you explain a bit more the idea behind returning the string "EMBED" and give an example of how this change would be used?

@hsj51
Copy link
Author

hsj51 commented Oct 16, 2024

Changes I have suggested is to return the base64 string of the image instead of the word 'EMBED'. This will enable user to reuse the image somewhere else in the report.

Below is an example use case:

Setting for EMBED

Library    SeleniumLibrary    screenshot_root_directory=EMBED

And add below lines to this function
https://github.com/robotframework/WebDemo/blob/c8d46736c8248c1ebdcd67ac77fcb5bdafdd4851/login_tests/resource.robot#L44

Welcome Page Should Be Open
...
    ${ss}=    Capture Page Screenshot
    Set Test Message    *HTML*Test Success<p><img src="data:image/png;base64,${ss}" width="256px">

Then this is what a report may look like
image

And Log file
image

This will allow an user to view the screenshots in the report itself and not search for it in the log file through a mountain of keywords.

Main goal for this change is reusability of the images. Current alternative for this is to use .png images, but then there will be multiple files to manage and sharing report become difficult.

@hsj51
Copy link
Author

hsj51 commented Oct 16, 2024

@emanlove I have tried to explain my changes and a possible use cases. Please feel free to reach out for any more queries

@emanlove
Copy link
Member

Alright, I see better your use case. And appreciate you highlighting the issue of writing to file and then "there will be multiple files to manage and sharing report become difficult". I do wonder if the solution might be added functionality to rebot to do this in a post processing step? Let me think about this a bit more. I think having other opinions could also be good here. If you have an account on the Robot Framework community, could you share your idea and reasons for it within the #seleniumlibray channel. If you don't have an account I could post there as well.

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

Successfully merging this pull request may close these issues.

2 participants