Skip to content

Commit 7e9c8ef

Browse files
authored
update workaround (#557)
1 parent 801a5a0 commit 7e9c8ef

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

docs/ios_xcuitest.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,21 @@ xpaths("//some xpaths")
9090
- `mobile:` commands depends on WDA and Apple's framework and the behaviour depends on them.
9191
- Sometimes issues occur such as "doubleTap isn't tapping #548"
9292
- workaround for it:
93-
```ruby
94-
def double_tap(element)
95-
# Find the object, then go to the middle of it, and double-tap
96-
tap_x = element.location.x + element.size.width * 0.50
97-
tap_y = element.location.y + element.size.height * 0.50
98-
execute_script 'mobile: doubleTap', x: tap_x, y: tap_y
99-
end
100-
```
93+
- with `selenium-webdriver >= 3.4.0`
94+
```ruby
95+
def double_tap(element)
96+
rect = element.rect
97+
execute_script 'mobile: doubleTap', x: rect.x + rect.width / 2, y: rect.y + rect.height / 2
98+
end
99+
```
100+
- with `selenium-webdriver < 3.4.0`
101+
```ruby
102+
def double_tap(element)
103+
size = element.size
104+
location = element.location
105+
execute_script 'mobile: doubleTap', x: location.x + size.width / 2, y: location.y + size.height / 2
106+
end
107+
```
101108

102109
## Other actions
103110
Basically, other actions such as `type` are compatible with `automationName = Appium`.

0 commit comments

Comments
 (0)