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.
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.