Skip to content

Commit 190a8fb

Browse files
committed
[py] warn about upcoming changes to move_to_element_with_offset behavior
1 parent be70262 commit 190a8fb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

py/selenium/webdriver/common/actions/mouse_button.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ class MouseButton:
2121
LEFT = 0
2222
MIDDLE = 1
2323
RIGHT = 2
24+
BACK = 3
25+
FORWARD = 4
26+

py/selenium/webdriver/common/actions/pointer_actions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
import warnings
18+
1719
from . import interaction
1820

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

5961
if x or y:
62+
warnings.warn(
63+
"move_to_element_with_offset() currently tries to use the top left corner "
64+
"of the element as the origin; in Selenium 4.3 it will use the in-view "
65+
"center point of the element as the origin.",
66+
DeprecationWarning,
67+
stacklevel=2
68+
)
6069
el_rect = element.rect
6170
left_offset = el_rect['width'] / 2
6271
top_offset = el_rect['height'] / 2

0 commit comments

Comments
 (0)