appium / WebDriverAgent

A WebDriver server for iOS and tvOS
Other
1.2k stars 377 forks source link

feat: Add /calibrate endpoint #785

Closed mykola-mokhnach closed 1 year ago

mykola-mokhnach commented 1 year ago

The PR adds GET /calibrate endpoint to WDA.

The idea is to use this special web page behind the endpoint to properly calibrate coordinates offset for nativeWebTap feature without applying ugly hacks like we do now. Basically I am going to add mobile: calibrateNativeToWebCoordinates endpoint, which will only work in web/safari context and it will be loading this url to mobile Safari. Then we perform native click at the window center, which should also show actual web click coordinates. Then we can calculate the actual native/web coordinates delta and keep it to properly transform further native gesture coordinates. Ofc, the recalibration would be needed if the device changes orientation and there will be corner cases, but that method would be much more reliable in comparison to the ugly platform-dependent algorithm we use now in the xcuitest driver.

Kudos to Benjamin Karran for sharing this great idea.

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 5.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: