@@ -9,16 +9,17 @@ class ScreenshotKeywords(LibraryComponent):
99
1010 def __init__ (self , ctx ):
1111 super ().__init__ (ctx )
12- self .log_dir = os .curdir
1312
1413 def get_async_keyword_group (self ) -> iScreenshotAsync :
1514 return self .ctx .get_current_library_context ().get_async_keyword_group (type (self ).__name__ )
1615
1716 @keyword
1817 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 ()
2223
2324 @keyword
2425 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
4142 self ._embed_to_log_as_file (path , 800 )
4243
4344 def _get_screenshot_path (self , filename ):
44- directory = self .log_dir
45+ directory = self .ctx . get_current_library_context (). get_screenshot_path ()
4546 filename = filename .replace ('/' , os .sep )
4647 index = 0
4748 while True :
@@ -62,7 +63,7 @@ def _embed_to_log_as_file(self, path, width):
6263 """
6364 self .info ('</td></tr><tr><td colspan="3">'
6465 '<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 )
6667
6768class _SafeFormatter (dict ):
6869
0 commit comments