diff --git a/DrissionPage/_units/rect.py b/DrissionPage/_units/rect.py index 43bfaef..8250642 100644 --- a/DrissionPage/_units/rect.py +++ b/DrissionPage/_units/rect.py @@ -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'] diff --git a/DrissionPage/_units/setter.py b/DrissionPage/_units/setter.py index 46353d0..25a7571 100644 --- a/DrissionPage/_units/setter.py +++ b/DrissionPage/_units/setter.py @@ -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')