3.2.18click()强制点击时如元素无法滚动到视口,改用js

This commit is contained in:
g1879 2023-03-14 18:32:30 +08:00
parent c2e8d86d38
commit b076ff9952

View File

@ -1668,7 +1668,10 @@ class Click(object):
can_click = True
break
if by_js is False or (can_click and not self._ele.states.is_covered):
if not self._ele.states.is_in_viewport:
by_js = True
elif can_click and (by_js is False or not self._ele.states.is_covered):
client_x, client_y = self._ele.locations.viewport_midpoint if self._ele.tag == 'input' \
else self._ele.locations.viewport_click_point
self._click(client_x, client_y)