From 9a518568d4f88a47c1c6d8bc8aabb7f21b5778b7 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Sat, 3 Aug 2024 00:53:45 -0400 Subject: [PATCH 1/2] Update error-handling for Mobile Mode --- seleniumbase/core/browser_launcher.py | 16 ++++++++-------- seleniumbase/fixtures/base_case.py | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py index fd91f59785f..b1b91b0b0e7 100644 --- a/seleniumbase/core/browser_launcher.py +++ b/seleniumbase/core/browser_launcher.py @@ -394,8 +394,8 @@ def uc_special_open_if_cf( ) uc_metrics = {} if ( - isinstance(device_width, (int, float)) - and isinstance(device_height, (int, float)) + isinstance(device_width, int) + and isinstance(device_height, int) and isinstance(device_pixel_ratio, (int, float)) ): uc_metrics["width"] = device_width @@ -1519,8 +1519,8 @@ def _set_chrome_options( emulator_settings = {} device_metrics = {} if ( - isinstance(device_width, (int, float)) - and isinstance(device_height, (int, float)) + isinstance(device_width, int) + and isinstance(device_height, int) and isinstance(device_pixel_ratio, (int, float)) ): device_metrics["width"] = device_width @@ -3269,8 +3269,8 @@ def get_local_driver( emulator_settings = {} device_metrics = {} if ( - isinstance(device_width, (int, float)) - and isinstance(device_height, (int, float)) + isinstance(device_width, int) + and isinstance(device_height, int) and isinstance(device_pixel_ratio, (int, float)) ): device_metrics["width"] = device_width @@ -4496,8 +4496,8 @@ def get_local_driver( if mobile_emulator: uc_metrics = {} if ( - isinstance(device_width, (int, float)) - and isinstance(device_height, (int, float)) + isinstance(device_width, int) + and isinstance(device_height, int) and isinstance(device_pixel_ratio, (int, float)) ): uc_metrics["width"] = device_width diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index 428e61c66f7..7c6bc35c1a6 100644 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -14818,8 +14818,8 @@ def setUp(self, masterqa_mode=False): metrics_list = metrics_string.split(",") exception_string = ( "Invalid input for Mobile Emulator device metrics!\n" - "Expecting a comma-separated string with three\n" - "integer values for Width, Height, and Pixel-Ratio.\n" + "Expecting a comma-separated string with integer values\n" + "for Width/Height, and an int or float for Pixel-Ratio.\n" 'Example: --metrics="411,731,3" ' ) if len(metrics_list) != 3: @@ -14827,7 +14827,7 @@ def setUp(self, masterqa_mode=False): try: self.__device_width = int(metrics_list[0]) self.__device_height = int(metrics_list[1]) - self.__device_pixel_ratio = int(metrics_list[2]) + self.__device_pixel_ratio = float(metrics_list[2]) self.mobile_emulator = True except Exception: raise Exception(exception_string) From c1d0497837a2659686f9d8794b5c411587caa249 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Sat, 3 Aug 2024 00:54:00 -0400 Subject: [PATCH 2/2] Version 4.29.6 --- seleniumbase/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index 08b97dcac47..cd6258b1a13 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.29.5" +__version__ = "4.29.6"