selenium_plus 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +26 -0
- data/features/iframe.feature +13 -2
- data/features/step_definitions/iframe_steps.rb +8 -4
- data/lib/selenium_plus/driver.rb +8 -0
- data/lib/selenium_plus/page_obj/iframe.rb +1 -4
- data/lib/selenium_plus/page_obj/page.rb +1 -1
- data/lib/selenium_plus/version.rb +1 -1
- data/test_site/html/home.html +1 -1
- data/test_site/html/inner_iframe.html +26 -0
- data/test_site/html/{iframe.html → outer_iframe.html} +1 -0
- data/test_site/iframes/{test_iframe.rb → inner_iframe.rb} +1 -1
- data/test_site/iframes/outer_iframe.rb +18 -0
- data/test_site/pages/home_page.rb +1 -1
- metadata +16 -14
data/README.md
CHANGED
@@ -34,6 +34,7 @@ end
|
|
34
34
|
|
35
35
|
class HomePage < SeleniumPlus::Page
|
36
36
|
|
37
|
+
iframe(:outer_iframe, OuterIframe, :id, 'outer_iframe')
|
37
38
|
section(:info_section, InfoSection, :id, 'info')
|
38
39
|
element(:show_btn, :css, 'input[value=Show]')
|
39
40
|
|
@@ -47,6 +48,23 @@ class HomePage < SeleniumPlus::Page
|
|
47
48
|
|
48
49
|
end
|
49
50
|
|
51
|
+
# define iframe
|
52
|
+
|
53
|
+
class OuterIframe < SeleniumPlus::Iframe
|
54
|
+
|
55
|
+
iframe(:inner_iframe, InnerIframe, :id, 'inner_iframe')
|
56
|
+
element(:h_table, :id, 'iframe_h_table')
|
57
|
+
element(:search_btn, :css, 'input[name=search]')
|
58
|
+
|
59
|
+
def h_table_hashes
|
60
|
+
h_table.table_hashes
|
61
|
+
end
|
62
|
+
|
63
|
+
def search_table
|
64
|
+
search_btn.click
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
50
68
|
# define sections
|
51
69
|
|
52
70
|
class InfoSection < SeleniumPlus::Section
|
@@ -104,6 +122,14 @@ Then /^Horizontal table text should be:$/ do |h_table|
|
|
104
122
|
@site.home_page.info_section.h_table.rows_text.should == h_table.rows
|
105
123
|
end
|
106
124
|
|
125
|
+
Then /^Horizontal table inside outer iframe should be:$/ do |h_table|
|
126
|
+
@site.home_page.outer_iframe.h_table_hashes.should == h_table.hashes
|
127
|
+
end
|
128
|
+
|
129
|
+
Then /^Horizontal table inside inner iframe should be:$/ do |h_table|
|
130
|
+
@site.home_page.outer_iframe.inner_iframe.h_table_hashes.should == h_table.hashes
|
131
|
+
end
|
132
|
+
|
107
133
|
```
|
108
134
|
|
109
135
|
Without using page object model
|
data/features/iframe.feature
CHANGED
@@ -4,7 +4,7 @@ Feature: Verify iframe
|
|
4
4
|
When I login to home page
|
5
5
|
|
6
6
|
Scenario: Find table inside iframe
|
7
|
-
Then Horizontal table inside iframe should be:
|
7
|
+
Then Horizontal table inside outer iframe should be:
|
8
8
|
| ID: | Name: | Company: |
|
9
9
|
| 1 | Jack | Google |
|
10
10
|
| 2 | Maggie | Microsoft |
|
@@ -12,10 +12,21 @@ Feature: Verify iframe
|
|
12
12
|
| ID: | Name: | Company: |
|
13
13
|
| 1 | Alex | Google |
|
14
14
|
| 2 | Eric | Microsoft |
|
15
|
-
And I search horizontal table inside iframe
|
15
|
+
And I search horizontal table inside outer iframe
|
16
16
|
And Section titles should be:
|
17
17
|
| Information tables |
|
18
18
|
| Table with no header |
|
19
19
|
| Table with no body |
|
20
|
+
And Horizontal table inside inner iframe should be:
|
21
|
+
| ID: | Name: | Company: |
|
22
|
+
| 1 | Bruce | HP |
|
23
|
+
| 2 | Joey | IBM |
|
24
|
+
And Definition list dt text should be:
|
25
|
+
| Coffee | Milk |
|
26
|
+
And Title inside div#info should be: Information tables
|
27
|
+
And Horizontal table inside outer iframe should be:
|
28
|
+
| ID: | Name: | Company: |
|
29
|
+
| 1 | Jack | Google |
|
30
|
+
| 2 | Maggie | Microsoft |
|
20
31
|
|
21
32
|
|
@@ -1,7 +1,11 @@
|
|
1
|
-
Then /^Horizontal table inside iframe should be:$/ do |h_table|
|
2
|
-
@site.home_page.
|
1
|
+
Then /^Horizontal table inside outer iframe should be:$/ do |h_table|
|
2
|
+
@site.home_page.outer_iframe.h_table_hashes.should == h_table.hashes
|
3
3
|
end
|
4
4
|
|
5
|
-
Then /^I search horizontal table inside iframe$/ do
|
6
|
-
@site.home_page.
|
5
|
+
Then /^I search horizontal table inside outer iframe$/ do
|
6
|
+
@site.home_page.outer_iframe.search_table
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^Horizontal table inside inner iframe should be:$/ do |h_table|
|
10
|
+
@site.home_page.outer_iframe.inner_iframe.h_table_hashes.should == h_table.hashes
|
7
11
|
end
|
data/lib/selenium_plus/driver.rb
CHANGED
@@ -55,6 +55,14 @@ module SeleniumPlus
|
|
55
55
|
native.save_screenshot(path)
|
56
56
|
end
|
57
57
|
|
58
|
+
def switch_to_frame(frame)
|
59
|
+
native.switch_to.frame(frame)
|
60
|
+
end
|
61
|
+
|
62
|
+
def switch_to_page
|
63
|
+
native.switch_to.default_content
|
64
|
+
end
|
65
|
+
|
58
66
|
def reset!
|
59
67
|
# Use instance variable directly so we avoid starting the browser just to reset the session
|
60
68
|
if @native
|
@@ -3,11 +3,8 @@ module SeleniumPlus
|
|
3
3
|
extend Container
|
4
4
|
include Finders
|
5
5
|
|
6
|
-
#attr_reader :iframe_element
|
7
|
-
|
8
6
|
def initialize(iframe_element)
|
9
|
-
SeleniumPlus.driver.
|
10
|
-
#@root_element = iframe_element
|
7
|
+
SeleniumPlus.driver.switch_to_frame(iframe_element)
|
11
8
|
end
|
12
9
|
|
13
10
|
end
|
data/test_site/html/home.html
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>iframe Page</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<table id="iframe_h_table" class="horizontal_headers">
|
8
|
+
<tr>
|
9
|
+
<th>ID:</th>
|
10
|
+
<th>Name:</th>
|
11
|
+
<th>Company:</th>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td>1</td>
|
15
|
+
<td>Bruce</td>
|
16
|
+
<td>HP</td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td>2</td>
|
20
|
+
<td>Joey</td>
|
21
|
+
<td>IBM</td>
|
22
|
+
</tr>
|
23
|
+
</table>
|
24
|
+
<input type="submit" value="Search" name="search" />
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Test
|
2
|
+
|
3
|
+
class OuterIframe < SeleniumPlus::Iframe
|
4
|
+
|
5
|
+
iframe(:inner_iframe, InnerIframe, :id, 'inner_iframe')
|
6
|
+
element(:h_table, :id, 'iframe_h_table')
|
7
|
+
element(:search_btn, :css, 'input[name=search]')
|
8
|
+
|
9
|
+
def h_table_hashes
|
10
|
+
h_table.table_hashes
|
11
|
+
end
|
12
|
+
|
13
|
+
def search_table
|
14
|
+
search_btn.click
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70211936386700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70211936386700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: selenium-webdriver
|
27
|
-
requirement: &
|
27
|
+
requirement: &70211936385780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.25.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70211936385780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70211936384680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70211936384680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: simplecov
|
49
|
-
requirement: &
|
49
|
+
requirement: &70211936383700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.7.1
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70211936383700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cucumber
|
60
|
-
requirement: &
|
60
|
+
requirement: &70211936382560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 1.2.1
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70211936382560
|
69
69
|
description: SeleniumPlus creates a very thin layer between Selenium and your applications,
|
70
70
|
it gives your a simple and quick way to describe your web site using the Page Object
|
71
71
|
Model.
|
@@ -113,9 +113,11 @@ files:
|
|
113
113
|
- lib/selenium_plus/version.rb
|
114
114
|
- selenium_plus.gemspec
|
115
115
|
- test_site/html/home.html
|
116
|
-
- test_site/html/
|
116
|
+
- test_site/html/inner_iframe.html
|
117
117
|
- test_site/html/login.html
|
118
|
-
- test_site/
|
118
|
+
- test_site/html/outer_iframe.html
|
119
|
+
- test_site/iframes/inner_iframe.rb
|
120
|
+
- test_site/iframes/outer_iframe.rb
|
119
121
|
- test_site/pages/home_page.rb
|
120
122
|
- test_site/pages/login_page.rb
|
121
123
|
- test_site/sections/info_section.rb
|