From 55ae42e9dfd002a66911e6aa2e636b91bf72c142 Mon Sep 17 00:00:00 2001 From: Mahadev_G <53810625+MahadevGopanpalli@users.noreply.github.com> Date: Thu, 3 Feb 2022 23:49:47 +0530 Subject: [PATCH 1/2] Update Screenshot_Clipping.py --- Screenshot/Screenshot_Clipping.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Screenshot/Screenshot_Clipping.py b/Screenshot/Screenshot_Clipping.py index 2985e20..47d1a63 100644 --- a/Screenshot/Screenshot_Clipping.py +++ b/Screenshot/Screenshot_Clipping.py @@ -118,7 +118,7 @@ def full_Screenshot(self, driver: WebDriver, save_path: str = '', image_name: st stitched_image.save(save_path) return save_path - def get_element(self, driver: WebDriver, element: WebElement, save_location: str, to_hide: list = None) -> str: + def get_element(self, driver: WebDriver, element: WebElement, save_location: str, image_name : str = 'cropped_screenshot.png', to_hide: list = None) -> str: """ Usage: Capture Element screenshot as a image @@ -144,7 +144,7 @@ def get_element(self, driver: WebDriver, element: WebElement, save_location: str image_object = Image.open(image) image_object = image_object.crop((int(x), int(y), int(width), int(height))) uid = str(uuid.uuid4()) - img_url = os.path.abspath(os.path.join(save_location, f"{uid}.png")) + img_url = os.path.abspath(os.path.join(save_location, f"{image_name}.png")) image_object.save(img_url) return img_url From 2bf709691726be54a103e3c6390ab99fd7aafcf5 Mon Sep 17 00:00:00 2001 From: Mahadev_G <53810625+MahadevGopanpalli@users.noreply.github.com> Date: Fri, 4 Feb 2022 09:31:14 +0530 Subject: [PATCH 2/2] Update Screenshot_Clipping.py Removed uuid variable --- Screenshot/Screenshot_Clipping.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Screenshot/Screenshot_Clipping.py b/Screenshot/Screenshot_Clipping.py index 47d1a63..fb0422e 100644 --- a/Screenshot/Screenshot_Clipping.py +++ b/Screenshot/Screenshot_Clipping.py @@ -143,7 +143,6 @@ def get_element(self, driver: WebDriver, element: WebElement, save_location: str image_object = Image.open(image) image_object = image_object.crop((int(x), int(y), int(width), int(height))) - uid = str(uuid.uuid4()) img_url = os.path.abspath(os.path.join(save_location, f"{image_name}.png")) image_object.save(img_url) return img_url