Commit b5fa16d
committed
⚡ Optimize Tap Loop by hoisting redundant element finding and coordinate calculation.
This change moves the `_element_find` call and the center coordinate calculations outside the repetition loop in the `tap` keyword. This avoids making multiple expensive Appium server calls for the same element when the `count` argument is greater than 1.
Key changes:
- Hoisted `self._element_find(element, True, True)` outside the loop.
- Hoisted `location` and `size` retrieval and `center_x`, `center_y` calculations outside the loop.
- The `driver.tap` call remains inside the loop to perform the requested number of taps at the calculated position.
Performance impact:
- Number of `_element_find` calls reduced from `count` to 1.
- Significant reduction in network/IPC latency for multi-tap operations.1 parent a9e90c0 commit b5fa16d
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
0 commit comments