小修复

This commit is contained in:
g1879 2024-07-05 17:49:53 +08:00
parent 8456f7ad39
commit 07de9eb131
2 changed files with 7 additions and 1 deletions

View File

@ -236,3 +236,9 @@ class FrameRect(object):
def viewport_corners(self):
"""返回元素四个角视口坐标,顺序:左上、右上、右下、左下"""
return self._frame.frame_ele.rect.viewport_corners
@property
def scrollbar_position(self):
"""返回滚动条位置,格式:(x, y)"""
r = self._frame._run_cdp_loaded('Page.getLayoutMetrics')['visualViewport']
return r['pageX'], r['pageY']

View File

@ -212,7 +212,7 @@ class ChromiumBaseSetter(BrowserBaseSetter):
def headers(self, headers) -> None:
"""设置固定发送的headers
:param headers: dict格式的headers数据
:param headers: dict格式的headers数据或从浏览器复制的headers文本\n分行
:return: None
"""
self._owner._run_cdp('Network.enable')