![](/img/trans.png)
[英]How is it possible to get the coordinates of a Swing components, irrespective to its parent?
[英]How to get coordinates of a map irrespective of screen resolution
我正在自動化基於 map(使用“MapBox”)web 應用程序,在 ZC71E8D607D4D1C216DE288
map 作為單個圖像檢索,我必須在 map 中找到不同區域的坐標。
為此,我找到了 x&y 坐標並執行了單擊操作。 但是我們確實有不同分辨率的機器來運行我們的腳本。
此時,坐標會發生變化,因此會單擊不正確的點(區域)。
無論機器分辨率如何,請通過概括坐標來幫助處理此問題。
用於點擊特定坐標的代碼如下:
Actions action = new Actions(getDriver());
action.moveByOffset(xcordinate, ycordinate).click().build().perform(); //coordinates changes as the resolution changes
這行代碼命名錯誤,我認為moveByOffset方法的參數不知道坐標,它可能代表相對像素position。 所以你應該乘以一個計算值(系數)來提供多屏幕分辨率。
action.moveByOffset(xcordinate, ycordinate)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.