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

When running ImageHorizonLibrary.Take A Screenshot keyword, path to the image should relative and not absolute

Open aaltat opened this issue 8 years ago • 2 comments
trafficstars

When I run my tests in CI, I do not want to store the the results in the job which did the actually running. I move the result to different places and even to outside of the CI. But because the ImageHorizonLibrary.Take A Screenshot keyword saves the paths to image as absolute paths, the images are not anymore shown when I move the log.html to a different folder structure.

Example when I save the Robot Framework results in /path/to/workspace/output/ folder, then with ImageHorizonLibrary.Take A Screenshot keyword the DOM is like this:

<img src="/path/to/workspace/output/filename-1.png" width="100%">`

But it should be like this:

<img src="filename-1.png" width="100%">

Example in Selenium2Library the same logic is done in here: https://github.com/robotframework/Selenium2Library/blob/master/src/Selenium2Library/keywords/screenshot.py#L115

aaltat avatar Apr 12 '17 08:04 aaltat

I looked at the code for ImageHorizonLibrary.Take A Screenshot today, I think I can provide a fix for this.

damies13 avatar Feb 25 '22 11:02 damies13

For anyone else having this issue, I have a workaround I use for now until the PR is added to a release.

I use sed to update the output.xml and then use rebot to regenerate the html reports like this:

          sed --in-place=.bak 's/img src="<path to image>/img src="./g' ./output.xml
          rebot ./output.xml

damies13 avatar Mar 16 '24 14:03 damies13