page-object 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/.travis.yml +7 -2
  5. data/ChangeLog +14 -1
  6. data/Gemfile +4 -2
  7. data/README.md +2 -0
  8. data/Rakefile +5 -1
  9. data/features/async.feature +3 -12
  10. data/features/audio.feature +10 -14
  11. data/features/element.feature +21 -0
  12. data/features/gxt_table_extension.feature +1 -2
  13. data/features/html/multi_elements.html +11 -10
  14. data/features/html/static_elements.html +3 -16
  15. data/features/html/widgets.html +20 -0
  16. data/features/italic.feature +21 -0
  17. data/features/multi_elements.feature +28 -22
  18. data/features/sample-app/public/audio_video.html +23 -0
  19. data/features/step_definitions/audio_steps.rb +6 -6
  20. data/features/step_definitions/element_steps.rb +28 -0
  21. data/features/step_definitions/gxt_table_steps.rb +1 -6
  22. data/features/step_definitions/italic_steps.rb +12 -0
  23. data/features/step_definitions/multi_elements_steps.rb +13 -0
  24. data/features/step_definitions/page_traversal_steps.rb +4 -0
  25. data/features/step_definitions/table_row_steps.rb +23 -0
  26. data/features/step_definitions/video_steps.rb +3 -3
  27. data/features/support/audio_video_page.rb +24 -0
  28. data/features/support/page.rb +20 -20
  29. data/features/support/url_helper.rb +4 -0
  30. data/features/table_row.feature +43 -0
  31. data/features/video.feature +1 -5
  32. data/lib/page-object.rb +4 -0
  33. data/lib/page-object/accessors.rb +88 -4
  34. data/lib/page-object/elements.rb +2 -1
  35. data/lib/page-object/elements/element.rb +5 -5
  36. data/lib/page-object/elements/italic.rb +11 -0
  37. data/lib/page-object/elements/ordered_list.rb +1 -1
  38. data/lib/page-object/elements/unordered_list.rb +1 -1
  39. data/lib/page-object/locator_generator.rb +2 -0
  40. data/lib/page-object/platforms/selenium_webdriver/element.rb +37 -0
  41. data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +10 -8
  42. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +51 -1
  43. data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +7 -9
  44. data/lib/page-object/platforms/watir_webdriver/element.rb +45 -1
  45. data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +9 -4
  46. data/lib/page-object/platforms/watir_webdriver/page_object.rb +81 -50
  47. data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +11 -5
  48. data/lib/page-object/version.rb +1 -1
  49. data/lib/page-object/widgets.rb +1 -1
  50. data/page-object.gemspec +1 -0
  51. data/spec/page-object/element_locators_spec.rb +124 -80
  52. data/spec/page-object/elements/element_spec.rb +83 -1
  53. data/spec/page-object/elements/italic_spec.rb +29 -0
  54. data/spec/page-object/elements/media_spec.rb +63 -0
  55. data/spec/page-object/elements/ordered_list_spec.rb +6 -22
  56. data/spec/page-object/elements/selenium_element_spec.rb +41 -0
  57. data/spec/page-object/elements/unordered_list_spec.rb +4 -21
  58. data/spec/page-object/elements/video_spec.rb +27 -0
  59. data/spec/page-object/elements/watir_element_spec.rb +48 -0
  60. data/spec/page-object/selenium_accessors_spec.rb +28 -9
  61. data/spec/page-object/watir_accessors_spec.rb +57 -1
  62. data/spec/spec_helper.rb +3 -6
  63. metadata +39 -3
@@ -20,7 +20,7 @@ module PageObject
20
20
  return type_to_class[type.to_sym] if type
21
21
  tag_to_class[tag_name.to_sym] || ::PageObject::Elements::Element
22
22
  end
23
-
23
+
24
24
  end
25
25
  end
26
26
  end
@@ -56,5 +56,6 @@ require 'page-object/elements/media'
56
56
  require 'page-object/elements/audio'
57
57
  require 'page-object/elements/video'
58
58
  require 'page-object/elements/bold'
59
+ require 'page-object/elements/italic'
59
60
 
60
61
 
@@ -10,7 +10,7 @@ module PageObject
10
10
  #
11
11
  class Element
12
12
  include ::PageObject::NestedElements
13
-
13
+
14
14
  attr_reader :element
15
15
 
16
16
  def initialize(element, platform)
@@ -40,14 +40,14 @@ module PageObject
40
40
  def disabled?
41
41
  not enabled?
42
42
  end
43
-
43
+
44
44
  #
45
45
  # get the value of the given CSS property
46
46
  #
47
47
  def style(property)
48
48
  element.style property
49
49
  end
50
-
50
+
51
51
  def inspect
52
52
  element.inspect
53
53
  end
@@ -97,7 +97,7 @@ module PageObject
97
97
  return how, what
98
98
  end
99
99
  end
100
-
100
+
101
101
  # @private
102
102
  # delegate calls to driver element
103
103
  def method_missing(*args, &block)
@@ -118,7 +118,7 @@ module PageObject
118
118
  protected
119
119
 
120
120
  def self.should_build_watir_xpath identifier
121
- ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video', 'b'].include? identifier[:tag_name] and identifier[:name]
121
+ ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video', 'b', 'i'].include? identifier[:tag_name] and identifier[:name]
122
122
  end
123
123
 
124
124
  def self.build_xpath_for identifier
@@ -0,0 +1,11 @@
1
+ module PageObject
2
+ module Elements
3
+ class Italic < Element
4
+
5
+ end
6
+
7
+ ::PageObject::Elements.tag_to_class[:i] = ::PageObject::Elements::Italic
8
+
9
+
10
+ end
11
+ end
@@ -23,7 +23,7 @@ module PageObject
23
23
  protected
24
24
 
25
25
  def child_xpath
26
- ".//child::li"
26
+ "./child::li"
27
27
  end
28
28
 
29
29
  def self.watir_finders
@@ -24,7 +24,7 @@ module PageObject
24
24
  protected
25
25
 
26
26
  def child_xpath
27
- ".//child::li"
27
+ "./child::li"
28
28
  end
29
29
 
30
30
  def self.watir_finders
@@ -83,6 +83,7 @@ module PageObject
83
83
  :span,
84
84
  :table,
85
85
  :cell,
86
+ :row,
86
87
  :image,
87
88
  :form,
88
89
  :list_item,
@@ -102,6 +103,7 @@ module PageObject
102
103
  :audio,
103
104
  :video,
104
105
  :b,
106
+ :i,
105
107
  :svg]
106
108
 
107
109
  def self.generate_locators(target)
@@ -280,6 +280,43 @@ module PageObject
280
280
  element.location_once_scrolled_into_view
281
281
  end
282
282
 
283
+ #
284
+ # location of element (x, y)
285
+ #
286
+ def location
287
+ element.location
288
+ end
289
+
290
+ #
291
+ # size of element (width, height)
292
+ #
293
+ def size
294
+ element.size
295
+ end
296
+
297
+ #
298
+ # Get height of element
299
+ #
300
+ def height
301
+ element.size['height']
302
+ end
303
+
304
+ #
305
+ # Get width of element
306
+ #
307
+ def width
308
+ element.size['width']
309
+ end
310
+
311
+ #
312
+ # Get centre coordinates of element
313
+ #
314
+ def centre
315
+ location = element.location
316
+ size = element.size
317
+ {'y' => (location['y'] + (size['height']/2)), 'x' => (location['x'] + (size['width']/2))}
318
+ end
319
+
283
320
  private
284
321
 
285
322
  def bridge
@@ -10,7 +10,7 @@ module PageObject
10
10
  # @return [PageObject::Elements::ListItem]
11
11
  #
12
12
  def [](idx)
13
- children[idx]
13
+ Object::PageObject::Elements::ListItem.new(children[idx], :platform => :selenium_webdriver)
14
14
  end
15
15
 
16
16
  #
@@ -20,16 +20,18 @@ module PageObject
20
20
  children.size
21
21
  end
22
22
 
23
- private
24
-
25
- def children
26
- items = list_items.map do |item|
27
- ::PageObject::Elements::ListItem.new(item, :platform => :selenium_webdriver)
23
+ #
24
+ # Return the ListItem objects that are children of the OrderedList
25
+ #
26
+ def list_items
27
+ children.collect do |obj|
28
+ Object::PageObject::Elements::ListItem.new(obj, :platform => :selenium_webdriver)
28
29
  end
29
- items.find_all { |item| item.parent.element == element }
30
30
  end
31
31
 
32
- def list_items
32
+ private
33
+
34
+ def children
33
35
  element.find_elements(:xpath, child_xpath)
34
36
  end
35
37
 
@@ -575,6 +575,31 @@ module PageObject
575
575
  find_selenium_elements(identifier, Elements::TableCell, 'td')
576
576
  end
577
577
 
578
+ #
579
+ # platform method to retrieve the text from a table row
580
+ # See PageObject::Accessors#row
581
+ #
582
+ def row_text_for(identifier)
583
+ process_selenium_call(identifier, Elements::TableRow, 'tr') do |how, what|
584
+ @browser.find_element(how, what).text
585
+ end
586
+ end
587
+
588
+ #
589
+ # platform method to retrieve a table row element
590
+ # See PageObject::Accessors#row
591
+ #
592
+ def row_for(identifier)
593
+ find_selenium_element(identifier, Elements::TableRow, 'tr')
594
+ end
595
+
596
+ #
597
+ # platform method to retrieve all table row elements
598
+ #
599
+ def rows_for(identifier)
600
+ find_selenium_elements(identifier, Elements::TableRow, 'tr')
601
+ end
602
+
578
603
  #
579
604
  # platform method to retrieve an image element
580
605
  # See PageObject::Accessors#image
@@ -1030,7 +1055,7 @@ module PageObject
1030
1055
  end
1031
1056
 
1032
1057
  #
1033
- # platform method to retrieve the h1 element
1058
+ # platform method to retrieve the b element
1034
1059
  # See PageObject::Accessors#b
1035
1060
  #
1036
1061
  def b_for(identifier)
@@ -1044,6 +1069,31 @@ module PageObject
1044
1069
  find_selenium_elements(identifier, Elements::Bold, 'b')
1045
1070
  end
1046
1071
 
1072
+ #
1073
+ # platform method to retrieve the text from a i
1074
+ # See PageObject::Accessors#i
1075
+ #
1076
+ def i_text_for(identifier)
1077
+ process_selenium_call(identifier, Elements::Italic, 'i') do |how, what|
1078
+ @browser.find_element(how, what).text
1079
+ end
1080
+ end
1081
+
1082
+ #
1083
+ # platform method to retrieve the i element
1084
+ # See PageObject::Accessors#i
1085
+ #
1086
+ def i_for(identifier)
1087
+ find_selenium_element(identifier, Elements::Italic, 'i')
1088
+ end
1089
+
1090
+ #
1091
+ # platform method to retrieve all i elements
1092
+ #
1093
+ def is_for(identifier)
1094
+ find_selenium_elements(identifier, Elements::Italic, 'i')
1095
+ end
1096
+
1047
1097
  private
1048
1098
 
1049
1099
  def process_selenium_call(identifier, type, tag, other=nil)
@@ -10,7 +10,7 @@ module PageObject
10
10
  # @return [PageObject::Elements::ListItem]
11
11
  #
12
12
  def [](idx)
13
- children[idx]
13
+ Object::PageObject::Elements::ListItem.new(children[idx], :platform => :selenium_webdriver)
14
14
  end
15
15
 
16
16
  #
@@ -20,19 +20,17 @@ module PageObject
20
20
  children.size
21
21
  end
22
22
 
23
- private
24
-
25
- def children
26
- items = list_items.map do |item|
27
- ::PageObject::Elements::ListItem.new(item, :platform => :selenium_webdriver)
23
+ def list_items
24
+ children.collect do |obj|
25
+ Object::PageObject::Elements::ListItem.new(obj, :platform => :selenium_webdriver)
28
26
  end
29
- items.find_all { |item| item.parent.element == element }
30
27
  end
31
28
 
32
- def list_items
29
+ private
30
+
31
+ def children
33
32
  element.find_elements(:xpath, child_xpath)
34
33
  end
35
-
36
34
  end
37
35
  end
38
36
  end
@@ -150,7 +150,14 @@ module PageObject
150
150
  def select_text(text)
151
151
  element.select_text text
152
152
  end
153
-
153
+
154
+ #
155
+ # Right click on an element
156
+ #
157
+ def right_click
158
+ element.right_click
159
+ end
160
+
154
161
  #
155
162
  # Waits until the element is present
156
163
  #
@@ -243,6 +250,43 @@ module PageObject
243
250
  def scroll_into_view
244
251
  element.wd.location_once_scrolled_into_view
245
252
  end
253
+
254
+ #
255
+ # location of element (x, y)
256
+ #
257
+ def location
258
+ element.wd.location
259
+ end
260
+
261
+ #
262
+ # size of element (width, height)
263
+ #
264
+ def size
265
+ element.wd.size
266
+ end
267
+
268
+ #
269
+ # Get height of element
270
+ #
271
+ def height
272
+ element.wd.size['height']
273
+ end
274
+
275
+ #
276
+ # Get width of element
277
+ #
278
+ def width
279
+ element.wd.size['width']
280
+ end
281
+
282
+ #
283
+ # Get centre coordinates of element
284
+ #
285
+ def centre
286
+ location = element.wd.location
287
+ size = element.wd.size
288
+ {'y' => (location['y'] + (size['height']/2)), 'x' => (location['x'] + (size['width']/2))}
289
+ end
246
290
  end
247
291
  end
248
292
  end
@@ -20,13 +20,18 @@ module PageObject
20
20
  children.size
21
21
  end
22
22
 
23
+ #
24
+ # Return the ListItem objects that are children of the OrderedList
25
+ #
26
+ def list_items
27
+ children.collect do |obj|
28
+ Object::PageObject::Elements::ListItem.new(obj, :platform => :watir_webdriver)
29
+ end
30
+ end
31
+
23
32
  private
24
33
 
25
34
  def children
26
- list_items.find_all { |item| item.parent == element }
27
- end
28
-
29
- def list_items
30
35
  element.ols(:xpath => child_xpath)
31
36
  end
32
37
  end
@@ -25,7 +25,7 @@ module PageObject
25
25
  def navigate_to(url)
26
26
  @browser.goto url
27
27
  end
28
-
28
+
29
29
  #
30
30
  # platform method to get the current url
31
31
  # See PageObject#current_url
@@ -118,7 +118,7 @@ module PageObject
118
118
  def execute_script(script, *args)
119
119
  @browser.execute_script(script, *args)
120
120
  end
121
-
121
+
122
122
  #
123
123
  # platform method to handle attaching to a running window
124
124
  # See PageObject#attach_to_window
@@ -132,7 +132,7 @@ module PageObject
132
132
  element = browser.execute_script("return document.activeElement")
133
133
  type = element.type.to_sym if element.tag_name.to_sym == :input
134
134
  cls = ::PageObject::Elements.element_class_for(element.tag_name, type)
135
- cls.new(element, :platform => :watir_webdriver)
135
+ cls.new(element, :platform => :watir_webdriver)
136
136
  end
137
137
 
138
138
  #
@@ -144,7 +144,7 @@ module PageObject
144
144
  frame << {frame: identifier}
145
145
  block.call(frame)
146
146
  end
147
-
147
+
148
148
  #
149
149
  # platform method to switch to an iframe and execute a block
150
150
  # See PageObject#in_frame
@@ -154,7 +154,7 @@ module PageObject
154
154
  frame << {iframe: identifier}
155
155
  block.call(frame)
156
156
  end
157
-
157
+
158
158
  #
159
159
  # platform method to refresh the page
160
160
  # See PageObject#refresh
@@ -162,7 +162,7 @@ module PageObject
162
162
  def refresh
163
163
  @browser.refresh
164
164
  end
165
-
165
+
166
166
  #
167
167
  # platform method to go back to the previous page
168
168
  # See PageObject#back
@@ -170,7 +170,7 @@ module PageObject
170
170
  def back
171
171
  @browser.back
172
172
  end
173
-
173
+
174
174
  #
175
175
  # platform method to go forward to the next page
176
176
  # See PageObject#forward
@@ -178,7 +178,7 @@ module PageObject
178
178
  def forward
179
179
  @browser.forward
180
180
  end
181
-
181
+
182
182
  #
183
183
  # platform method to clear the cookies from the browser
184
184
  # See PageObject#clear_cookies
@@ -210,7 +210,7 @@ module PageObject
210
210
  def text_field_value_set(identifier, value)
211
211
  process_watir_call("text_field(identifier).set(value)", Elements::TextField, identifier, value)
212
212
  end
213
-
213
+
214
214
  #
215
215
  # platform method to retrieve a text field element
216
216
  # See PageObject::Accessors#text_field
@@ -320,7 +320,7 @@ module PageObject
320
320
  # See PageObject::Accessors#link
321
321
  #
322
322
  def click_link_for(identifier)
323
- call = call_for_watir_element(identifier, "link(identifier)")
323
+ call = "link(identifier)"
324
324
  process_watir_call("#{call}.click if identifier", Elements::Link, identifier)
325
325
  end
326
326
 
@@ -329,7 +329,7 @@ module PageObject
329
329
  # see PageObject::Accessors#link
330
330
  #
331
331
  def link_for(identifier)
332
- call = call_for_watir_element(identifier, "link(identifier)")
332
+ call = "link(identifier)"
333
333
  find_watir_element(call, Elements::Link, identifier)
334
334
  end
335
335
 
@@ -337,7 +337,7 @@ module PageObject
337
337
  # platform method to retrieve an array of link elements
338
338
  #
339
339
  def links_for(identifier)
340
- call = call_for_watir_elements(identifier, "links(identifier)")
340
+ call = "links(identifier)"
341
341
  find_watir_elements(call, Elements::Link, identifier)
342
342
  end
343
343
 
@@ -462,7 +462,7 @@ module PageObject
462
462
  # See PageObject::Accessors#button
463
463
  #
464
464
  def click_button_for(identifier)
465
- call = call_for_watir_element(identifier, "button(identifier)")
465
+ call = "button(identifier)"
466
466
  process_watir_call("#{call}.click", Elements::Button, identifier)
467
467
  end
468
468
 
@@ -471,7 +471,7 @@ module PageObject
471
471
  # See PageObject::Accessors#button
472
472
  #
473
473
  def button_for(identifier)
474
- call = call_for_watir_element(identifier, "button(identifier)")
474
+ call = "button(identifier)"
475
475
  find_watir_element(call, Elements::Button, identifier)
476
476
  end
477
477
 
@@ -479,7 +479,7 @@ module PageObject
479
479
  # platform method to retrieve an array of button elements
480
480
  #
481
481
  def buttons_for(identifier)
482
- call = call_for_watir_elements(identifier, "buttons(identifier)")
482
+ call = "buttons(identifier)"
483
483
  find_watir_elements(call, Elements::Button, identifier)
484
484
  end
485
485
 
@@ -530,6 +530,30 @@ module PageObject
530
530
  find_watir_elements("tds(identifier)", Elements::TableCell, identifier, 'td')
531
531
  end
532
532
 
533
+ #
534
+ # platform method to retrieve the text from a table row
535
+ # See PageObject::Accessors#row
536
+ #
537
+ def row_text_for(identifier)
538
+ process_watir_call("tr(identifier).text", Elements::TableRow, identifier,
539
+ nil, 'tr')
540
+ end
541
+
542
+ #
543
+ # platform method to retrieve a table row element
544
+ # See PageObject::Accessors#row
545
+ #
546
+ def row_for(identifier)
547
+ find_watir_element("tr(identifier)", Elements::TableRow, identifier, 'tr')
548
+ end
549
+
550
+ #
551
+ # platform method to retrieve an array of table row elements
552
+ #
553
+ def rows_for(identifier)
554
+ find_watir_elements("trs(identifier)", Elements::TableRow, identifier, 'tr')
555
+ end
556
+
533
557
  #
534
558
  # platform method to retrieve an image element
535
559
  # See PageObject::Accessors#image
@@ -621,7 +645,7 @@ module PageObject
621
645
  def ordered_list_for(identifier)
622
646
  find_watir_element("ol(identifier)", Elements::OrderedList, identifier, 'ol')
623
647
  end
624
-
648
+
625
649
  #
626
650
  # platform method to retrieve an array of ordered lists
627
651
  #
@@ -636,14 +660,14 @@ module PageObject
636
660
  def h1_text_for(identifier)
637
661
  process_watir_call("h1(identifier).text", Elements::Heading, identifier, nil, 'h1')
638
662
  end
639
-
663
+
640
664
  #
641
665
  # platform method to retrieve the h1 element
642
666
  # See PageObject::Accessors#h1
643
667
  #
644
668
  def h1_for(identifier)
645
669
  find_watir_element("h1(identifier)", Elements::Heading, identifier, 'h1')
646
- end
670
+ end
647
671
 
648
672
  #
649
673
  # platform method to retrieve an array of h1s
@@ -659,14 +683,14 @@ module PageObject
659
683
  def h2_text_for(identifier)
660
684
  process_watir_call("h2(identifier).text", Elements::Heading, identifier, nil, 'h2')
661
685
  end
662
-
686
+
663
687
  #
664
688
  # platform method to retrieve the h2 element
665
689
  # See PageObject::Accessors#h2
666
690
  #
667
691
  def h2_for(identifier)
668
692
  find_watir_element("h2(identifier)", Elements::Heading, identifier, 'h2')
669
- end
693
+ end
670
694
 
671
695
  #
672
696
  # platform method to retrieve an array of h2s
@@ -682,14 +706,14 @@ module PageObject
682
706
  def h3_text_for(identifier)
683
707
  process_watir_call("h3(identifier).text", Elements::Heading, identifier, nil, 'h3')
684
708
  end
685
-
709
+
686
710
  #
687
711
  # platform method to retrieve the h3 element
688
712
  # See PageObject::Accessors#h3
689
713
  #
690
714
  def h3_for(identifier)
691
715
  find_watir_element("h3(identifier)", Elements::Heading, identifier, 'h3')
692
- end
716
+ end
693
717
 
694
718
  #
695
719
  # platform method to retrieve an array of h3s
@@ -705,14 +729,14 @@ module PageObject
705
729
  def h4_text_for(identifier)
706
730
  process_watir_call("h4(identifier).text", Elements::Heading, identifier, nil, 'h4')
707
731
  end
708
-
732
+
709
733
  #
710
734
  # platform method to retrieve the h4 element
711
735
  # See PageObject::Accessors#h4
712
736
  #
713
737
  def h4_for(identifier)
714
738
  find_watir_element("h4(identifier)", Elements::Heading, identifier, 'h4')
715
- end
739
+ end
716
740
 
717
741
  #
718
742
  # platform method to retrieve an array of h4s
@@ -728,14 +752,14 @@ module PageObject
728
752
  def h5_text_for(identifier)
729
753
  process_watir_call("h5(identifier).text", Elements::Heading, identifier, nil, 'h5')
730
754
  end
731
-
755
+
732
756
  #
733
757
  # platform method to retrieve the h5 element
734
758
  # See PageObject::Accessors#h5
735
759
  #
736
760
  def h5_for(identifier)
737
761
  find_watir_element("h5(identifier)", Elements::Heading, identifier, 'h5')
738
- end
762
+ end
739
763
 
740
764
  #
741
765
  # platform method to retrieve an array of h5s
@@ -751,14 +775,14 @@ module PageObject
751
775
  def h6_text_for(identifier)
752
776
  process_watir_call("h6(identifier).text", Elements::Heading, identifier, nil, 'h6')
753
777
  end
754
-
778
+
755
779
  #
756
780
  # platform method to retrieve the h6 element
757
781
  # See PageObject::Accessors#h6
758
782
  #
759
783
  def h6_for(identifier)
760
784
  find_watir_element("h6(identifier)", Elements::Heading, identifier, 'h6')
761
- end
785
+ end
762
786
 
763
787
  #
764
788
  # platform method to retrieve an array of h6s
@@ -774,7 +798,7 @@ module PageObject
774
798
  def paragraph_text_for(identifier)
775
799
  process_watir_call("p(identifier).text", Elements::Paragraph, identifier, nil, 'p')
776
800
  end
777
-
801
+
778
802
  #
779
803
  # platform method to retrieve the paragraph element
780
804
  # See PageObject::Accessors#paragraph
@@ -939,7 +963,7 @@ module PageObject
939
963
  def svg_for(identifier)
940
964
  find_watir_element("element(identifier)", Elements::Element, identifier)
941
965
  end
942
-
966
+
943
967
  #
944
968
  # platform method to return an array of svg elements
945
969
  #
@@ -957,7 +981,7 @@ module PageObject
957
981
 
958
982
  #
959
983
  # platform method to retrieve the b element
960
- # See PageObject::Accessors#h1
984
+ # See PageObject::Accessors#b
961
985
  #
962
986
  def b_for(identifier)
963
987
  find_watir_element("b(identifier)", Elements::Bold, identifier, 'b')
@@ -969,7 +993,30 @@ module PageObject
969
993
  def bs_for(identifier)
970
994
  find_watir_elements("bs(identifier)", Elements::Bold, identifier, 'b')
971
995
  end
972
-
996
+
997
+ #
998
+ # platform method to retrieve the text for a i
999
+ # See PageObject::Accessors#i
1000
+ #
1001
+ def i_text_for(identifier)
1002
+ process_watir_call("i(identifier).text", Elements::Italic, identifier, nil, 'i')
1003
+ end
1004
+
1005
+ #
1006
+ # platform method to retrieve the i element
1007
+ # See PageObject::Accessors#i
1008
+ #
1009
+ def i_for(identifier)
1010
+ find_watir_element("i(identifier)", Elements::Italic, identifier, 'i')
1011
+ end
1012
+
1013
+ #
1014
+ # platform method to retrieve an array of is
1015
+ #
1016
+ def is_for(identifier)
1017
+ find_watir_elements("is(identifier)", Elements::Italic, identifier, 'i')
1018
+ end
1019
+
973
1020
  private
974
1021
 
975
1022
  def find_watir_elements(the_call, type, identifier, tag_name=nil)
@@ -1040,23 +1087,7 @@ module PageObject
1040
1087
  end
1041
1088
 
1042
1089
  def switch_to_default_content(frame_identifiers)
1043
- @browser.wd.switch_to.default_content unless frame_identifiers.nil?
1044
- end
1045
-
1046
- def css_element
1047
- "element(identifier)"
1048
- end
1049
-
1050
- def css_elements
1051
- "elements(identifier)"
1052
- end
1053
-
1054
- def call_for_watir_element(identifier, call)
1055
- identifier[:css] ? "#{css_element}" : call
1056
- end
1057
-
1058
- def call_for_watir_elements(identifier, call)
1059
- identifier[:css] ? "#{css_elements}" : call
1090
+ @browser.wd.switch_to.default_content unless frame_identifiers.nil?
1060
1091
  end
1061
1092
 
1062
1093
  def switch_to_frame(frame_identifiers)
@@ -1066,7 +1097,7 @@ module PageObject
1066
1097
  value = frame_id.values.first
1067
1098
  @browser.wd.switch_to.frame(value)
1068
1099
  end
1069
- end
1100
+ end
1070
1101
  end
1071
1102
  end
1072
1103
  end