【问题标题】:Find Screen Coordinates of WebElement in WebDirver Automation在 WebDriver 自动化中查找 WebElement 的屏幕坐标
【发布时间】:2016-12-05 22:14:19
【问题描述】:

我正在尝试查找特定 WebElement 的确切屏幕坐标。它使用 User32 dll (SetCursorPos(x,y)) 并将光标移动到该位置的目的。并在 User32 dll 中调用 mouse_event() 方法以使鼠标中轮滚动到该元素上。

有没有办法找到屏幕坐标?我可以用 webelement.Location 找到元素坐标,但这个位置不是屏幕坐标。

我正在使用 c# Websriver。

【问题讨论】:

    标签: c# webdriver


    【解决方案1】:

    使用 User32 dll GetWindowRect() 或使用 Java 脚本 element.getBoundingRecatangleClient() 将用于获取相对于屏幕的坐标。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-09
      • 2023-03-29
      相关资源
      最近更新 更多