@@ -16,6 +16,7 @@ def commands(command)
16
16
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
17
17
#
18
18
# @private
19
+ # For Appium
19
20
# override
20
21
#
21
22
# @example
@@ -31,6 +32,7 @@ def action(async = false)
31
32
end
32
33
alias actions action
33
34
35
+ # For Appium
34
36
# override
35
37
def page_source
36
38
# For W3C
@@ -40,13 +42,15 @@ def page_source
40
42
execute :get_page_source
41
43
end
42
44
45
+ # For Appium
43
46
# override
44
47
def element_attribute ( element , name )
45
48
# For W3C
46
49
# execute_atom :getAttribute, element, name
47
50
execute :get_element_attribute , id : element . ref , name : name
48
51
end
49
52
53
+ # For Appium
50
54
# override
51
55
def find_element_by ( how , what , parent = nil )
52
56
how , what = convert_locators ( how , what )
@@ -59,6 +63,7 @@ def find_element_by(how, what, parent = nil)
59
63
::Selenium ::WebDriver ::Element . new self , element_id_from ( id )
60
64
end
61
65
66
+ # For Appium
62
67
# override
63
68
def find_elements_by ( how , what , parent = nil )
64
69
how , what = convert_locators ( how , what )
@@ -72,6 +77,32 @@ def find_elements_by(how, what, parent = nil)
72
77
ids . map { |id | ::Selenium ::WebDriver ::Element . new self , element_id_from ( id ) }
73
78
end
74
79
80
+ # For Appium
81
+ # override
82
+ def location
83
+ obj = execute ( :get_location ) || { }
84
+ Location . new obj [ 'latitude' ] , obj [ 'longitude' ] , obj [ 'altitude' ]
85
+ end
86
+
87
+ # For Appium
88
+ # override
89
+ def set_location ( lat , lon , alt )
90
+ loc = { latitude : lat , longitude : lon , altitude : alt }
91
+ execute :set_location , { } , { location : loc }
92
+ end
93
+
94
+ # For Appium
95
+ # override
96
+ def network_connection
97
+ execute :get_network_connection
98
+ end
99
+
100
+ # For Appium
101
+ # override
102
+ def network_connection = ( type )
103
+ execute :set_network_connection , { } , { parameters : { type : type } }
104
+ end
105
+
75
106
private
76
107
77
108
# Don't convert locators for Appium Client
0 commit comments