Module: TestaAppiumDriver::ClassSelectors

Included in:
Appium::Core::Element, Driver, Locator
Defined in:
lib/testa_appium_driver/android/class_selectors.rb

Overview

noinspection ALL

Instance Method Summary collapse

Instance Method Details

#add_selector(*args, &block) ⇒ TestaAppiumDriver::Locator



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 6

def add_selector(*args, &block)
  # if class selector is executed from driver, create new locator instance
  if self.kind_of?(TestaAppiumDriver::Driver) || self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
    args.last[:default_find_strategy] = @default_find_strategy
    args.last[:default_scroll_strategy] = @default_scroll_strategy
    if self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
      driver = self.get_driver
    else
      driver = self
    end
    Locator.new(driver, self, *args)
  else
    # class selector is executed from locator, just add child selector criteria
    self.add_child_selector(*args)
  end
end

#button(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.Button element that match given selectors



167
168
169
170
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 167

def button(params = {})
  params[:class] = "android.widget.Button"
  add_selector(params)
end

#buttons(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.Button elements that match given selectors



174
175
176
177
178
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 174

def buttons(params = {})
  params[:class] = "android.widget.Button"
  params[:single] = false
  add_selector(params)
end

#card_view(params = {}) ⇒ TestaAppiumDriver::Locator

first androidx.cardview.widget.CardView element that match given selectors



393
394
395
396
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 393

def card_view(params = {})
  params[:class] = "androidx.cardview.widget.CardView"
  add_selector(params)
end

#card_views(params = {}) ⇒ TestaAppiumDriver::Locator

all androidx.cardview.widget.CardView elements that match given selectors



400
401
402
403
404
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 400

def card_views(params = {})
  params[:class] = "androidx.cardview.widget.CardView"
  params[:single] = false
  add_selector(params)
end

#check_box(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.CheckBox element that match given selectors



242
243
244
245
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 242

def check_box(params = {})
  params[:class] = "android.widget.CheckBox"
  add_selector(params)
end

#check_boxes(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.CheckBox elements that match given selectors



249
250
251
252
253
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 249

def check_boxes(params = {})
  params[:class] = "android.widget.CheckBox"
  params[:single] = false
  add_selector(params)
end

#edit_text(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.EditText element that match given selectors



107
108
109
110
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 107

def edit_text(params = {})
  params[:class] = "android.widget.EditText"
  add_selector(params)
end

#edit_texts(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.EditText elements that match given selectors



114
115
116
117
118
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 114

def edit_texts(params = {})
  params[:class] = "android.widget.EditText"
  params[:single] = false
  add_selector(params)
end

#element(selectors = {}) ⇒ TestaAppiumDriver::Locator

first element that match given selectors

Parameters:

  • selectors (Hash) (defaults to: {})

Returns:



26
27
28
29
30
31
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 26

def element(selectors = {})
  unless selectors[:image].nil?
    selectors[:strategy] = FIND_STRATEGY_IMAGE
  end
  add_selector(selectors)
end

#elements(params = {}) ⇒ TestaAppiumDriver::Locator

all elements that match given selectors

Parameters:

  • params (Hash) (defaults to: {})

Returns:



36
37
38
39
40
41
42
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 36

def elements(params = {})
  unless params[:image].nil?
    params[:strategy] = FIND_STRATEGY_IMAGE
  end
  params[:single] = false
  add_selector(params)
end

#frame_layout(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.FrameLayout element that match given selectors



62
63
64
65
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 62

def frame_layout(params = {})
  params[:class] = "android.widget.FrameLayout"
  add_selector(params)
end

#frame_layouts(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.FrameLayout elements that match given selectors



69
70
71
72
73
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 69

def frame_layouts(params = {})
  params[:class] = "android.widget.FrameLayout"
  params[:single] = false
  add_selector(params)
end

#horizontal_scroll_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.HorizontalScrollView element that match given selectors



197
198
199
200
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 197

def horizontal_scroll_view(params = {})
  params[:class] = "android.widget.HorizontalScrollView"
  add_selector(params)
end

#horizontal_scroll_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.HorizontalScrollView elements that match given selectors



204
205
206
207
208
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 204

def horizontal_scroll_views(params = {})
  params[:class] = "android.widget.HorizontalScrollView"
  params[:single] = false
  add_selector(params)
end

#image_button(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.ImageButton element that match given selectors



182
183
184
185
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 182

def image_button(params = {})
  params[:class] = "android.widget.ImageButton"
  add_selector(params)
end

#image_buttons(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.ImageButton elements that match given selectors



189
190
191
192
193
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 189

def image_buttons(params = {})
  params[:class] = "android.widget.ImageButton"
  params[:single] = false
  add_selector(params)
end

#image_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.ImageView element that match given selectors



47
48
49
50
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 47

def image_view(params = {})
  params[:class] = "android.widget.ImageView"
  add_selector(params)
end

#image_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.ImageView elements that match given selectors



54
55
56
57
58
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 54

def image_views(params = {})
  params[:class] = "android.widget.ImageView"
  params[:single] = false
  add_selector(params)
end

#linear_layout(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.LinearLayout element that match given selectors



77
78
79
80
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 77

def linear_layout(params = {})
  params[:class] = "android.widget.LinearLayout"
  add_selector(params)
end

#linear_layouts(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.LinearLayout elements that match given selectors



84
85
86
87
88
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 84

def linear_layouts(params = {})
  params[:class] = "android.widget.LinearLayout"
  params[:single] = false
  add_selector(params)
end

#list_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.ListView element that match given selectors



257
258
259
260
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 257

def list_view(params = {})
  params[:class] = "android.widget.ListView"
  add_selector(params)
end

#list_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.ListView elements that match given selectors



264
265
266
267
268
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 264

def list_views(params = {})
  params[:class] = "android.widget.ListView"
  params[:single] = false
  add_selector(params)
end

#progress_bar(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.ProgressBar element that match given selectors



272
273
274
275
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 272

def progress_bar(params = {})
  params[:class] = "android.widget.ProgressBar"
  add_selector(params)
end

#progress_bars(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.ProgressBar elements that match given selectors



279
280
281
282
283
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 279

def progress_bars(params = {})
  params[:class] = "android.widget.ProgressBar"
  params[:single] = false
  add_selector(params)
end

#radio_button(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.RadioButton element that match given selectors



287
288
289
290
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 287

def radio_button(params = {})
  params[:class] = "android.widget.RadioButton"
  add_selector(params)
end

#radio_buttons(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.RadioButton elements that match given selectors



294
295
296
297
298
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 294

def radio_buttons(params = {})
  params[:class] = "android.widget.RadioButton"
  params[:single] = false
  add_selector(params)
end

#radio_group(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.RadioGroup element that match given selectors



302
303
304
305
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 302

def radio_group(params = {})
  params[:class] = "android.widget.RadioGroup"
  add_selector(params)
end

#radio_groups(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.RadioGroup elements that match given selectors



309
310
311
312
313
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 309

def radio_groups(params = {})
  params[:class] = "android.widget.RadioGroup"
  params[:single] = false
  add_selector(params)
end

#recycler_view(params = {}) ⇒ TestaAppiumDriver::Locator

first androidx.recyclerview.widget.RecyclerView element that match given selectors



152
153
154
155
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 152

def recycler_view(params = {})
  params[:class] = "androidx.recyclerview.widget.RecyclerView"
  add_selector(params)
end

#recycler_views(params = {}) ⇒ TestaAppiumDriver::Locator

all androidx.recyclerview.widget.RecyclerView elements that match given selectors



159
160
161
162
163
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 159

def recycler_views(params = {})
  params[:class] = "androidx.recyclerview.widget.RecyclerView"
  params[:single] = false
  add_selector(params)
end

#relative_layout(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.RelativeLayout element that match given selecotrs



137
138
139
140
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 137

def relative_layout(params = {})
  params[:class] = "android.widget.RelativeLayout"
  add_selector(params)
end

#relative_layouts(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.RelativeLayout elements that match given selectors



144
145
146
147
148
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 144

def relative_layouts(params = {})
  params[:class] = "android.widget.RelativeLayout"
  params[:single] = false
  add_selector(params)
end

#scroll_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.ScrollView element that match given selectors



212
213
214
215
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 212

def scroll_view(params = {})
  params[:class] = "android.widget.ScrollView"
  add_selector(params)
end

#scroll_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.ScrollView elements that match given selectors



219
220
221
222
223
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 219

def scroll_views(params = {})
  params[:class] = "android.widget.ScrollView"
  params[:single] = false
  add_selector(params)
end

#search_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.SearchView element that match given selectors



317
318
319
320
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 317

def search_view(params = {})
  params[:class] = "android.widget.SearchView"
  add_selector(params)
end

#search_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.SearchView elements that match given selectors



324
325
326
327
328
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 324

def search_views(params = {})
  params[:class] = "android.widget.SearchView"
  params[:single] = false
  add_selector(params)
end

#spinner(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.Spinner element that match given selectors



332
333
334
335
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 332

def spinner(params = {})
  params[:class] = "android.widget.Spinner"
  add_selector(params)
end

#spinners(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.Spinner elements that match given selectors



339
340
341
342
343
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 339

def spinners(params = {})
  params[:class] = "android.widget.Spinner"
  params[:single] = false
  add_selector(params)
end

#switch(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.Switch element that match given selectors



408
409
410
411
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 408

def switch(params = {})
  params[:class] = "android.widget.Switch"
  add_selector(params)
end

#switches(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.Switch elements that match given selectors



415
416
417
418
419
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 415

def switches(params = {})
  params[:class] = "android.widget.Switch"
  params[:single] = false
  add_selector(params)
end

#text_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.TextView element that match given selectors



377
378
379
380
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 377

def text_view(params = {})
  params[:class] = "android.widget.TextView"
  add_selector(params)
end

#text_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.TextView elements that match given selectors



384
385
386
387
388
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 384

def text_views(params = {})
  params[:class] = "android.widget.TextView"
  params[:single] = false
  add_selector(params)
end

#toast(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.Toast element that match given selectors



347
348
349
350
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 347

def toast(params = {})
  params[:class] = "android.widget.Toast"
  add_selector(params)
end

#toasts(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.Toast elements that match given selectors



354
355
356
357
358
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 354

def toasts(params = {})
  params[:class] = "android.widget.Toast"
  params[:single] = false
  add_selector(params)
end

#toolbar(params = {}) ⇒ TestaAppiumDriver::Locator

first android.widget.Toolbar element that match given selectors



362
363
364
365
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 362

def toolbar(params = {})
  params[:class] = "android.widget.Toolbar"
  add_selector(params)
end

#toolbars(params = {}) ⇒ TestaAppiumDriver::Locator

all android.widget.Toolbar elements that match given selectors



369
370
371
372
373
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 369

def toolbars(params = {})
  params[:class] = "android.widget.Toolbar"
  params[:single] = false
  add_selector(params)
end

#view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.view.View element that match given selectors



92
93
94
95
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 92

def view(params = {})
  params[:class] = "android.view.View"
  add_selector(params)
end

#view_group(params = {}) ⇒ TestaAppiumDriver::Locator

first android.view.ViewGroup element that match given selectors



122
123
124
125
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 122

def view_group(params = {})
  params[:class] = "android.view.ViewGroup"
  add_selector(params)
end

#view_groups(params = {}) ⇒ TestaAppiumDriver::Locator

all android.view.ViewGroup elements that match given selectors



129
130
131
132
133
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 129

def view_groups(params = {})
  params[:class] = "android.view.ViewGroup"
  params[:single] = false
  add_selector(params)
end

#view_pager(params = {}) ⇒ TestaAppiumDriver::Locator

first viewpager.widget.ViewPager element that match given selectors



227
228
229
230
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 227

def view_pager(params = {})
  params[:class] = "androidx.viewpager.widget.ViewPager"
  add_selector(params)
end

#view_pagers(params = {}) ⇒ TestaAppiumDriver::Locator

all viewpager.widget.ViewPager elements that match given selectors



234
235
236
237
238
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 234

def view_pagers(params = {})
  params[:class] = "androidx.viewpager.widget.ViewPager"
  params[:single] = false
  add_selector(params)
end

#views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.view.View elements that match given selectors



99
100
101
102
103
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 99

def views(params = {})
  params[:class] = "android.view.View"
  params[:single] = false
  add_selector(params)
end

#web_view(params = {}) ⇒ TestaAppiumDriver::Locator

first android.webkit.WebView element that match given selectors



424
425
426
427
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 424

def web_view(params = {})
  params[:class] = "android.webkit.WebView"
  add_selector(params)
end

#web_views(params = {}) ⇒ TestaAppiumDriver::Locator

all android.webkit.WebView elements that match given selectors



431
432
433
434
435
# File 'lib/testa_appium_driver/android/class_selectors.rb', line 431

def web_views(params = {})
  params[:class] = "android.webkit.WebView"
  params[:single] = false
  add_selector(params)
end