five

获取元素坐标

收藏
用友数据2024-05-23 收录
下载链接:
https://api.yonyoucloud.com/apilink/tempServicePages/6ba49850-683e-4242-aa88-ff93e118aeb2_true.html
下载链接
链接失效反馈
官方服务:
资源简介:
浏览器流程自动化或UI自动测试时,通常是通过元素ID、Name、CSS、XPath等定位方式查找元素,然后对查找后的元素进行操作。但是是长期的支持中发现,存在这种情况:“定位方式发生了变化(通过元素ID、Name、CSS、XPath等方式),但是元素在页面中渲染及所呈现的内容是不变的”。这时如果仍然以正常的定位方式去查找元素的话,是不能查找到元素的。但是可以通过在录制时存储元素的截图信息,然后在回放时通过图形对比方式计算出元素截图在当前电脑截屏中的坐标位置,进而通过操作系统原生的方式去操作元素(点击、双击等)

When performing browser workflow automation or UI automated testing, elements are usually located via positioning strategies including element ID, Name, CSS selector, XPath, etc., followed by operations on the located elements. However, during prolonged maintenance and support operations, a common scenario was identified: the positioning methods (e.g., element ID, Name, CSS selector, XPath) change, yet the element's on-page rendering and displayed content remain unchanged. In such scenarios, attempting to locate the element using the original standard positioning methods will result in failed detection. However, this issue can be resolved by storing the screenshot of the target element during the recording phase. During playback, the coordinate position of the stored element screenshot within the current computer screen capture can be calculated using graphical comparison techniques, followed by operating the element via native operating system methods such as click, double-click, etc.
二维码
社区交流群
二维码
科研交流群
商业服务