Skip to content

Commit

Permalink
Merge pull request #3 from qtacore/bugfix/page-scroll
Browse files Browse the repository at this point in the history
解决页面scrollLeft或scrollTop不为0导致获取控件坐标错误问题
  • Loading branch information
drunkdream authored Feb 25, 2019
2 parents f8f32d5 + d1613bd commit 12c0dd6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions qt4w/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ class WebDriverBase(IWebDriver):
var rect = node.getBoundingClientRect();
var scale = this.getScale();
scale *= this.getElementZoom(node);
result.push(rect.left * scale);
result.push(rect.top * scale);
result.push((rect.right - rect.left) * scale);
result.push((rect.bottom - rect.top) * scale);
var left = rect.left - document.body.scrollLeft;
var top = rect.top - document.body.scrollTop;
result.push(left * scale);
result.push(top * scale);
result.push(rect.width * scale);
result.push(rect.height * scale);
return result.toString();
},
Expand Down

0 comments on commit 12c0dd6

Please sign in to comment.