Skip to content

Commit 8c725b5

Browse files
committed
Squashed commit of the following:
commit 85cd76a Author: Dave Amies <damies13@gmail.com> Date: Fri Feb 25 22:24:00 2022 +1000 Fix for Issue eficode#28 relative path for screenshots 2 After testing needed a minor change, not sure why raw string didn't work, but escaped string does. commit e6cf36f Author: Dave Amies <damies13@gmail.com> Date: Fri Feb 25 22:02:19 2022 +1000 Fix for Issue eficode#28 relative path for screenshots
1 parent 0778575 commit 8c725b5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/ImageHorizonLibrary/recognition/_screenshot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from os.path import abspath, join as path_join
2+
from os.path import abspath, relpath, join as path_join
33
from random import choice
44
from string import ascii_lowercase
55

@@ -43,6 +43,8 @@ def take_a_screenshot(self):
4343
'"%s"' % target_dir)
4444
path = self._make_up_filename()
4545
path = abspath(path_join(target_dir, path))
46+
logpath = BuiltIn().get_variable_value('${OUTPUT DIR}')
47+
relativepath = relpath(path, start=logpath).replace('\\', '\/')
4648
LOGGER.info('Screenshot taken: {0}<br/><img src="{0}" '
47-
'width="100%" />'.format(path), html=True)
49+
'width="100%" />'.format(relativepath), html=True)
4850
ag.screenshot(path)

0 commit comments

Comments
 (0)