@@ -753,8 +753,8 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
753753 r"\/" ,
754754 r":" ,
755755 ] # Symbols that can't be used in filename
756- picture_quality = 20 # Quality of picture
757- picture_size = 800 , 600 # Size of image (for reduction in file size)
756+ picture_quality = 100 # Quality of picture
757+ picture_size = 1920 , 1080 # Size of image (for reduction in file size)
758758
759759 # Adjust filename and create full path (remove invalid characters, convert spaces to underscore, remove leading and trailing spaces)
760760 trans_table = str .maketrans (
@@ -773,9 +773,7 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
773773 image .save (ImageName , format = "PNG" ) # Save to disk
774774
775775 # Exit if we don't have a driver yet (happens when Test Step is set to mobile/web, but we haven't setup the driver)
776- elif Driver == None and (
777- Method == "mobile" or Method == "web"
778- ):
776+ elif Driver is None and Method in ("mobile" , "web" ):
779777 ExecLog (
780778 sModuleInfo ,
781779 "Can't capture screen, driver not available for type: %s, or invalid driver: %s"
@@ -786,15 +784,11 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
786784
787785 # Capture screenshot of web browser
788786 elif Method == "web" :
789- Driver .get_screenshot_as_file (
790- ImageName
791- ) # Must be .png, otherwise an exception occurs
787+ Driver .get_screenshot_as_file (ImageName ) # Must be .png, otherwise an exception occurs
792788
793789 # Capture screenshot of mobile
794790 elif Method == "mobile" :
795- Driver .save_screenshot (
796- ImageName
797- ) # Must be .png, otherwise an exception occurs
791+ Driver .save_screenshot (ImageName ) # Must be .png, otherwise an exception occurs
798792 else :
799793 ExecLog (
800794 sModuleInfo ,
@@ -805,12 +799,8 @@ def Thread_ScreenShot(function_name, image_folder, Method, Driver, image_name):
805799 # Lower the picture quality
806800 if os .path .exists (ImageName ): # Make sure image was saved
807801 image = Image .open (ImageName ) # Re-open in standard format
808- image .thumbnail (
809- picture_size , Image .ANTIALIAS
810- ) # Resize picture to lower file size
811- image .save (
812- ImageName , format = "PNG" , quality = picture_quality
813- ) # Change quality to reduce file size
802+ image .thumbnail (picture_size , Image .ANTIALIAS ) # Resize picture to lower file size
803+ image .save (ImageName , format = "PNG" , quality = picture_quality ) # Change quality to reduce file size
814804
815805 # Convert image to bytearray and send it to ws for streaming.
816806 image_byte_array = pil_image_to_bytearray (image )
0 commit comments