From c4d4582c36c9a923bb299d345158a8ad918b6581 Mon Sep 17 00:00:00 2001 From: Vinyzu <50874994+Vinyzu@users.noreply.github.com> Date: Sun, 12 May 2024 21:57:57 +0200 Subject: [PATCH] Remove mid_location [Update v1.1] --- tests/test_async_driverless.py | 10 +++++++++- tests/test_sync_driverless.py | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/test_async_driverless.py b/tests/test_async_driverless.py index 80b81e6..1b03752 100644 --- a/tests/test_async_driverless.py +++ b/tests/test_async_driverless.py @@ -12,7 +12,15 @@ async def get_locator_pos(locator: WebElement): - return await locator.mid_location(spread_a=0.5, spread_b=0.5, border=0.1) + location = await locator.location + size = await locator.size + assert location, size + + x, y, width, height = location.get("x"), location.get("y"), size.get("width"), size.get("height") + assert x and y and width and height + + x, y = x + width // 2, y + height // 2 + return x, y @pytest.mark.skip("Currently bugged by Driverless. Skipping until Update.") diff --git a/tests/test_sync_driverless.py b/tests/test_sync_driverless.py index 3a58a19..e34781b 100644 --- a/tests/test_sync_driverless.py +++ b/tests/test_sync_driverless.py @@ -12,7 +12,15 @@ def get_locator_pos(locator: WebElement): - return locator.mid_location(spread_a=0.5, spread_b=0.5, border=0.1) + location = locator.location + size = locator.size + assert location, size + + x, y, width, height = location.get("x"), location.get("y"), size.get("width"), size.get("height") + assert x and y and width and height + + x, y = x + width // 2, y + height // 2 + return x, y def test_input_leak(sync_driver: Chrome, server: Server) -> None: