Skip to content

Commit

Permalink
[py] warn about upcoming changes to move_to_element_with_offset behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed May 27, 2022
1 parent be70262 commit 190a8fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions py/selenium/webdriver/common/actions/mouse_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ class MouseButton:
LEFT = 0
MIDDLE = 1
RIGHT = 2
BACK = 3
FORWARD = 4

9 changes: 9 additions & 0 deletions py/selenium/webdriver/common/actions/pointer_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

from . import interaction

from .interaction import Interaction
Expand Down Expand Up @@ -57,6 +59,13 @@ def move_to(self, element, x=0, y=0, width=None, height=None, pressure=None,
raise AttributeError("move_to requires a WebElement")

if x or y:
warnings.warn(
"move_to_element_with_offset() currently tries to use the top left corner "
"of the element as the origin; in Selenium 4.3 it will use the in-view "
"center point of the element as the origin.",
DeprecationWarning,
stacklevel=2
)
el_rect = element.rect
left_offset = el_rect['width'] / 2
top_offset = el_rect['height'] / 2
Expand Down

0 comments on commit 190a8fb

Please sign in to comment.