From 91011fb4490663a5e1c2a1964e22fa51bc3ecd22 Mon Sep 17 00:00:00 2001 From: amit3200 Date: Wed, 25 Oct 2023 18:13:07 +0530 Subject: [PATCH] Updating Comment for Info --- packages/webdriver-utils/src/providers/genericProvider.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/webdriver-utils/src/providers/genericProvider.js b/packages/webdriver-utils/src/providers/genericProvider.js index bb5371a0d..d6c3d694e 100644 --- a/packages/webdriver-utils/src/providers/genericProvider.js +++ b/packages/webdriver-utils/src/providers/genericProvider.js @@ -214,8 +214,10 @@ export default class GenericProvider { const rect = await this.driver.rect(elementId); const location = { x: rect.x, y: rect.y }; const size = { height: rect.height, width: rect.width }; - // Update YFactor Element is not visible in viewport - // In case of iOS if the element is not visible in viewport it gives 0,0 as coordinate. + // Update pageShiftFactor Element is not visible in viewport + // In case of iOS if the element is not visible in viewport it gives 0 for x-y coordinate. + // In case of iOS if the element is partially visible it gives negative x-y coordinate. + // Subtracting ScrollY/ScrollX ensures if the element is visible in viewport or not. await this.updatePageShiftFactor(location); const coOrdinates = { top: Math.floor(location.y * scaleFactor) + this.pageYShiftFactor,