获取元素size更准确;

This commit is contained in:
g1879 2023-09-08 17:36:00 +08:00
parent e9d499bcb8
commit a6233aa923

View File

@ -123,8 +123,8 @@ class ChromiumElement(DrissionElement):
@property
def size(self):
"""返回元素宽和高组成的元组"""
model = self.page.run_cdp('DOM.getBoxModel', backendNodeId=self._backend_id)['model']
return model['width'], model['height']
border = self.page.run_cdp('DOM.getBoxModel', backendNodeId=self._backend_id)['model']['border']
return int(border[2] - border[0]), int(border[5] - border[1])
@property
def set(self):