watir-webdriver 0.0.4 → 0.0.5
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.rdoc +11 -0
- data/VERSION +1 -1
- data/lib/watir-webdriver/elements/frame.rb +29 -4
- data/spec/watirspec/frame_spec.rb +7 -0
- data/watir-webdriver.gemspec +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -7,6 +7,17 @@ See http://rubyforge.org/pipermail/wtr-development/2009-October/001313.html.
|
|
7
7
|
|
8
8
|
http://jarib.github.com/watir-webdriver/doc/
|
9
9
|
|
10
|
+
= Example
|
11
|
+
|
12
|
+
require 'watir-webdriver'
|
13
|
+
|
14
|
+
browser = Watir::Browser.new :firefox
|
15
|
+
browser.goto "http://google.com"
|
16
|
+
browser.text_field(:name => 'q').set("WebDriver rocks!")
|
17
|
+
browser.button(:name => 'btnG').click
|
18
|
+
puts browser.url
|
19
|
+
browser.close
|
20
|
+
|
10
21
|
= Description
|
11
22
|
|
12
23
|
The file in lib/watir/elements/generated.rb is autogenerated from the HTML5 spec. This is done by extracting the IDL parts from the spec and processing them with the WebIDL gem (link below).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
@@ -13,7 +13,8 @@ module Watir
|
|
13
13
|
@parent.assert_exists
|
14
14
|
|
15
15
|
if @iframe
|
16
|
-
|
16
|
+
switch_to_iframe(@iframe)
|
17
|
+
driver
|
17
18
|
elsif @frame_id.nil?
|
18
19
|
locate_iframe || locate_frame
|
19
20
|
else
|
@@ -46,14 +47,19 @@ module Watir
|
|
46
47
|
|
47
48
|
def locate_iframe
|
48
49
|
# hack - frame doesn't have IFrame's attributes either
|
49
|
-
@iframe =
|
50
|
+
@iframe = IFrame.new(@parent, @selector).locate
|
51
|
+
|
52
|
+
if @iframe
|
53
|
+
switch_to_iframe @iframe
|
54
|
+
driver
|
55
|
+
end
|
50
56
|
end
|
51
57
|
|
52
58
|
def locate_frame
|
53
59
|
loc = VALID_LOCATORS.find { |loc| @selector[loc] }
|
54
60
|
|
55
61
|
unless loc
|
56
|
-
raise MissingWayOfFindingObjectException, "can only
|
62
|
+
raise MissingWayOfFindingObjectException, "can only locate frames by #{VALID_LOCATORS.inspect}"
|
57
63
|
end
|
58
64
|
|
59
65
|
@frame_id = @selector[loc]
|
@@ -70,7 +76,26 @@ module Watir
|
|
70
76
|
def switch!
|
71
77
|
driver.switch_to.frame @frame_id
|
72
78
|
rescue Selenium::WebDriver::Error::NoSuchFrameError => e
|
73
|
-
raise
|
79
|
+
raise UnknownFrameException, e.message
|
80
|
+
end
|
81
|
+
|
82
|
+
def switch_to_iframe(element)
|
83
|
+
loc = [:id, :name].find { |e| not [nil, ""].include?(element.attribute(e)) }
|
84
|
+
if loc.nil?
|
85
|
+
raise MissingWayOfFindingObjectException, "can't switch to frame without :id or :name"
|
86
|
+
end
|
87
|
+
|
88
|
+
# TODO: get rid of this when we can switch to elements
|
89
|
+
# http://groups.google.com/group/selenium-developers/browse_thread/thread/428bd68e9e8bfecd/19a02ecd20835249
|
90
|
+
|
91
|
+
if @parent.kind_of? Frame
|
92
|
+
parent_id = @parent.instance_variable_get("@frame_id")
|
93
|
+
loc = [parent_id, element.attribute(loc)].join(".")
|
94
|
+
else
|
95
|
+
loc = element.attribute(loc)
|
96
|
+
end
|
97
|
+
|
98
|
+
driver.switch_to.frame loc
|
74
99
|
end
|
75
100
|
|
76
101
|
end # Frame
|
@@ -62,6 +62,13 @@ describe "Frame" do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
it "handles nested frames" do
|
66
|
+
browser.goto(WatirSpec.host + "/nested_frames.html")
|
67
|
+
|
68
|
+
browser.frame(:id, "two").frame(:id, "three").link(:id => "four").click
|
69
|
+
browser.title.should == "definition_lists"
|
70
|
+
end
|
71
|
+
|
65
72
|
it "raises TypeError when 'what' argument is invalid" do
|
66
73
|
lambda { browser.frame(:id, 3.14).exists? }.should raise_error(TypeError)
|
67
74
|
end
|
data/watir-webdriver.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{watir-webdriver}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jari Bakken"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-26}
|
13
13
|
s.description = %q{WebDriver-backed Watir}
|
14
14
|
s.email = %q{jari.bakken@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jari Bakken
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-26 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|