11---
2- title : " Scroll wheel actions "
3- linkTitle : " Wheel "
2+ title : " 滚轮操作 "
3+ linkTitle : " 滚轮 "
44weight : 6
55description : >
6- A representation of a scroll wheel input device for interacting with a web page .
6+ 一种用于与网页交互的滚轮输入设备的示意 .
77---
88
99{{< badge-version version="4.2" >}}
1010{{< badge-browser browser=Chromium wpt="perform_actions/wheel.py" >}}
1111
12- There are 5 scenarios for scrolling on a page .
12+ 在页面上滚动有 5 种情况 .
1313
14- ## Scroll to element
14+ ## 滚动到元素
1515
16- This is the most common scenario. Unlike traditional click and send keys methods,
17- the actions class does not automatically scroll the target element into view,
18- so this method will need to be used if elements are not already inside the viewport.
16+ 这是最常见的场景.
17+ 与传统的点击和发送按键的方法不同,
18+ 动作类不会自动将目标元素滚动到视图中,
19+ 因此如果元素不在视口内,
20+ 就需要使用此方法.
1921
20- This method takes a web element as the sole argument .
22+ 此方法仅将一个网页元素作为参数 .
2123
22- Regardless of whether the element is above or below the current viewscreen,
23- the viewport will be scrolled so the bottom of the element is at the bottom of the screen .
24+ 无论该元素是在当前视图屏幕的上方还是下方,
25+ 视口都会滚动, 使该元素的底部位于屏幕底部 .
2426
2527{{< tabpane text=true >}}
2628{{< tab header="Java" >}}
@@ -43,10 +45,11 @@ the viewport will be scrolled so the bottom of the element is at the bottom of t
4345{{< /tab >}}
4446{{< /tabpane >}}
4547
46- ## Scroll by given amount
48+ ## 按给定的量进行滚动
4749
48- This is the second most common scenario for scrolling. Pass in an delta x and a delta y value for how much to scroll
49- in the right and down directions. Negative values represent left and up, respectively.
50+ 这是第二种最常见的滚动场景.
51+ 传入一个 x 方向的偏移量和一个 y 方向的偏移量,
52+ 表示向右和向下滚动的距离. 负值分别表示向左和向上滚动.
5053
5154{{< tabpane text=true >}}
5255{{< tab header="Java" >}}
@@ -69,17 +72,17 @@ in the right and down directions. Negative values represent left and up, respect
6972{{< /tab >}}
7073{{< /tabpane >}}
7174
72- ## Scroll from an element by a given amount
75+ ## 将元素按照给定的量进行滚动
7376
74- This scenario is effectively a combination of the above two methods .
77+ 这种情形实际上是上述两种方法的结合 .
7578
76- To execute this use the "Scroll From" method, which takes 3 arguments.
77- The first represents the origination point, which we designate as the element,
78- and the second two are the delta x and delta y values.
79+ 要执行此操作, 请使用“从...滚动”方法,
80+ 该方法需要 3 个参数.
81+ 第一个参数表示起始点, 我们将其指定为元素,
82+ 后两个参数分别是 x 偏移量和 y 偏移量的值.
7983
80- If the element is out of the viewport,
81- it will be scrolled to the bottom of the screen, then the page will be scrolled by the provided
82- delta x and delta y values.
84+ 如果元素不在视口内, 它将滚动到屏幕底部,
85+ 然后页面将根据提供的 x 和 y 偏移量进行滚动.
8386
8487{{< tabpane text=true >}}
8588{{< tab header="Java" >}}
@@ -102,23 +105,22 @@ delta x and delta y values.
102105{{< /tab >}}
103106{{< /tabpane >}}
104107
105- ## Scroll from an element with an offset
108+ ## 从具有偏移量的元素进行滚动
106109
107- This scenario is used when you need to scroll only a portion of the screen, and it is outside the viewport.
108- Or is inside the viewport and the portion of the screen that must be scrolled
109- is a known offset away from a specific element .
110+ 当您需要滚动屏幕的某一部分, 而该部分位于视口之外,
111+ 或者位于视口之内但必须滚动的屏幕部分与特定元素之间存在已知偏移量时,
112+ 会使用此场景 .
110113
111- This uses the "Scroll From" method again, and in addition to specifying the element,
112- an offset is specified to indicate the origin point of the scroll. The offset is
113- calculated from the center of the provided element .
114+ 这再次使用了“从...滚动”的方法, 并且除了指定元素之外,
115+ 还指定了一个偏移量来表明滚动的起始点.
116+ 该偏移量是从所提供的元素的中心计算得出的 .
114117
115- If the element is out of the viewport,
116- it first will be scrolled to the bottom of the screen, then the origin of the scroll will be determined
117- by adding the offset to the coordinates of the center of the element, and finally
118- the page will be scrolled by the provided delta x and delta y values.
118+ 如果元素不在视口内, 它首先会被滚动到屏幕底部,
119+ 然后滚动的原点将通过将偏移量添加到元素中心的坐标来确定,
120+ 最后页面将根据提供的 x 和 y 偏移量值进行滚动.
119121
120- Note that if the offset from the center of the element falls outside of the viewport,
121- it will result in an exception .
122+ 请注意, 如果元素中心的偏移量超出视口范围,
123+ 将会导致异常 .
122124
123125{{< tabpane text=true >}}
124126{{< tab header="Java" >}}
@@ -141,18 +143,17 @@ it will result in an exception.
141143{{< /tab >}}
142144{{< /tabpane >}}
143145
144- ## Scroll from a offset of origin (element) by given amount
146+ ## 从给定元素的原点偏移量处滚动指定的距离
145147
146- The final scenario is used when you need to scroll only a portion of the screen,
147- and it is already inside the viewport .
148+ 最后一种情况适用于您需要滚动屏幕的某一部分,
149+ 而该部分已处于视口内的情况 .
148150
149- This uses the "Scroll From" method again, but the viewport is designated instead
150- of an element. An offset is specified from the upper left corner of the
151- current viewport. After the origin point is determined,
152- the page will be scrolled by the provided delta x and delta y values.
151+ 这再次使用了“从...滚动”的方法, 但这次指定的是视口而非某个元素.
152+ 从当前视口的左上角开始指定偏移量.
153+ 确定原点后, 页面将根据提供的 x 偏移量和 y 偏移量进行滚动.
153154
154- Note that if the offset from the upper left corner of the viewport falls outside of the screen,
155- it will result in an exception .
155+ 请注意, 如果从视口左上角算起的偏移量超出屏幕范围,
156+ 将会导致异常 .
156157
157158{{< tabpane text=true >}}
158159{{< tab header="Java" >}}
0 commit comments