@@ -9,16 +9,17 @@ class ScreenshotKeywords(LibraryComponent):
9
9
10
10
def __init__ (self , ctx ):
11
11
super ().__init__ (ctx )
12
- self .log_dir = os .curdir
13
12
14
13
def get_async_keyword_group (self ) -> iScreenshotAsync :
15
14
return self .ctx .get_current_library_context ().get_async_keyword_group (type (self ).__name__ )
16
15
17
16
@keyword
18
17
def set_screenshot_directory (self , path ):
19
- self .log_dir = path
20
- if not os .path .exists (path ):
21
- os .makedirs (path )
18
+ self .ctx .get_current_library_context ().set_screenshot_path (path )
19
+
20
+ @keyword
21
+ def get_screenshot_directory (self ):
22
+ return self .ctx .get_current_library_context ().get_screenshot_path ()
22
23
23
24
@keyword
24
25
def capture_page_screenshot (self , filename = DEFAULT_FILENAME_PAGE , fullPage = False ):
@@ -41,7 +42,7 @@ def capture_page_screenshot(self, filename=DEFAULT_FILENAME_PAGE, fullPage=False
41
42
self ._embed_to_log_as_file (path , 800 )
42
43
43
44
def _get_screenshot_path (self , filename ):
44
- directory = self .log_dir
45
+ directory = self .ctx . get_current_library_context (). get_screenshot_path ()
45
46
filename = filename .replace ('/' , os .sep )
46
47
index = 0
47
48
while True :
@@ -62,7 +63,7 @@ def _embed_to_log_as_file(self, path, width):
62
63
"""
63
64
self .info ('</td></tr><tr><td colspan="3">'
64
65
'<a href="{src}"><img src="{src}" width="{width}px"></a>'
65
- .format (src = get_link_path (path , self . log_dir ), width = width ), html = True )
66
+ .format (src = get_link_path (path , os . curdir ), width = width ), html = True )
66
67
67
68
class _SafeFormatter (dict ):
68
69
0 commit comments