@@ -77,7 +77,7 @@ def pytest_bdd_after_step(self, request, feature, scenario, step, step_func, ste
7777 uuid = get_uuid (str (id (step )))
7878 with self .lifecycle .update_step (uuid = uuid ) as step_result :
7979 step_result .status = Status .PASSED
80- self ._attach_screenshot_after_step (uuid , step_func , step_func_args )
80+ self ._attach_screenshot_after_step (request , uuid , step_func , step_func_args )
8181 self .lifecycle .stop_step (uuid = uuid )
8282
8383 @pytest .hookimpl
@@ -86,7 +86,7 @@ def pytest_bdd_step_error(self, request, feature, scenario, step, step_func, ste
8686 with self .lifecycle .update_step (uuid = uuid ) as step_result :
8787 step_result .status = Status .FAILED
8888 step_result .statusDetails = get_status_details (exception )
89- self ._attach_screenshot_after_step (uuid , step_func , step_func_args )
89+ self ._attach_screenshot_after_step (request , uuid , step_func , step_func_args )
9090 self .lifecycle .stop_step (uuid = uuid )
9191
9292 @pytest .hookimpl
@@ -139,9 +139,11 @@ def attach_file(self, source, name, attachment_type, extension):
139139 self .lifecycle .attach_file (uuid4 (), source , name = name , attachment_type = attachment_type , extension = extension )
140140
141141
142- def _attach_screenshot_after_step (self , uuid , step_func , step_func_args ):
142+ def _attach_screenshot_after_step (self , request , uuid , step_func , step_func_args ):
143143 driver_instance = None
144- if step_func_args :
144+ if request and "driver" in request .fixturenames :
145+ driver_instance = request .getfixturevalue ("driver" )
146+ elif step_func_args :
145147 for arg in step_func_args .keys ():
146148 if 'driver' == arg or "_driver" in arg :
147149 driver_instance = step_func_args .get (arg )
0 commit comments