watir-webdriver 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/watir-webdriver/attribute_helper.rb +10 -0
- data/lib/watir-webdriver/elements/element.rb +1 -1
- data/lib/watir-webdriver/elements/file_field.rb +0 -17
- data/lib/watir-webdriver/elements/image.rb +3 -3
- data/lib/watir-webdriver/elements/text_field.rb +0 -10
- data/lib/watir-webdriver/version.rb +1 -1
- data/lib/watir-webdriver/window_switching.rb +12 -12
- metadata +2 -2
@@ -52,6 +52,8 @@ module Watir
|
|
52
52
|
define_boolean_attribute(method_name, attribute_name)
|
53
53
|
when :int
|
54
54
|
define_int_attribute(method_name, attribute_name)
|
55
|
+
when :float
|
56
|
+
define_float_attribute(method_name, attribute_name)
|
55
57
|
else
|
56
58
|
# $stderr.puts "treating #{type.inspect} as string for now"
|
57
59
|
end
|
@@ -79,6 +81,14 @@ module Watir
|
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
84
|
+
def define_float_attribute(mname, aname)
|
85
|
+
define_method mname do
|
86
|
+
assert_exists
|
87
|
+
value = @element.attribute(aname)
|
88
|
+
value && Float(value)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
82
92
|
def add_attributes(attributes)
|
83
93
|
attributes.each do |type, attr_list|
|
84
94
|
typed_attributes[type] += attr_list
|
@@ -24,23 +24,6 @@ module Watir
|
|
24
24
|
path = path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
|
25
25
|
@element.send_keys path
|
26
26
|
end
|
27
|
-
|
28
|
-
#
|
29
|
-
# Return the value of this field
|
30
|
-
#
|
31
|
-
# In IE, the path returned depends on the "Include local directory path
|
32
|
-
# when uploading files to a server" security setting:
|
33
|
-
#
|
34
|
-
# @see http://msdn.microsoft.com/en-us/library/ms535128(VS.85).aspx
|
35
|
-
#
|
36
|
-
# @return [String]
|
37
|
-
#
|
38
|
-
|
39
|
-
def value
|
40
|
-
# since 'value' is an attribute on input fields, we override this here
|
41
|
-
assert_exists
|
42
|
-
@element.value
|
43
|
-
end
|
44
27
|
end
|
45
28
|
|
46
29
|
module Container
|
@@ -28,17 +28,17 @@ module Watir
|
|
28
28
|
|
29
29
|
def file_created_date
|
30
30
|
assert_exists
|
31
|
-
raise NotImplementedError
|
31
|
+
raise NotImplementedError, "not currently supported by WebDriver"
|
32
32
|
end
|
33
33
|
|
34
34
|
def file_size
|
35
35
|
assert_exists
|
36
|
-
raise NotImplementedError
|
36
|
+
raise NotImplementedError, "not currently supported by WebDriver"
|
37
37
|
end
|
38
38
|
|
39
39
|
def save(path)
|
40
40
|
assert_exists
|
41
|
-
raise NotImplementedError
|
41
|
+
raise NotImplementedError, "not currently supported by WebDriver"
|
42
42
|
end
|
43
43
|
|
44
44
|
end # Image
|
@@ -38,16 +38,6 @@ module Watir
|
|
38
38
|
@element.clear
|
39
39
|
end
|
40
40
|
|
41
|
-
#
|
42
|
-
# Returns the text in the text field.
|
43
|
-
#
|
44
|
-
|
45
|
-
def value
|
46
|
-
# since 'value' is an attribute on input fields, we override this here
|
47
|
-
assert_exists
|
48
|
-
@element.value
|
49
|
-
end
|
50
|
-
|
51
41
|
private
|
52
42
|
|
53
43
|
def locate
|
@@ -7,7 +7,7 @@ module Watir
|
|
7
7
|
if args.empty?
|
8
8
|
all
|
9
9
|
else
|
10
|
-
filter_windows(args, all
|
10
|
+
filter_windows extract_selector(args), all
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -21,15 +21,13 @@ module Watir
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def filter_windows(
|
25
|
-
|
26
|
-
|
27
|
-
unless sel.keys.all? { |k| [:title, :url].include? k }
|
28
|
-
raise ArgumentError, "invalid window selector: #{sel.inspect}"
|
24
|
+
def filter_windows(selector, windows)
|
25
|
+
unless selector.keys.all? { |k| [:title, :url].include? k }
|
26
|
+
raise ArgumentError, "invalid window selector: #{selector.inspect}"
|
29
27
|
end
|
30
28
|
|
31
|
-
|
32
|
-
|
29
|
+
windows.select do |win|
|
30
|
+
selector.all? { |key, value| value === win.send(key) }
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end # WindowSwitching
|
@@ -46,7 +44,7 @@ module Watir
|
|
46
44
|
elsif selector.has_key? :handle
|
47
45
|
@handle = selector.delete :handle
|
48
46
|
else
|
49
|
-
unless selector.keys.all? { |k| [:title, :url].include? k }
|
47
|
+
unless selector.keys.all? { |k| [:title, :url, :index].include? k }
|
50
48
|
raise ArgumentError, "invalid window selector: #{selector.inspect}"
|
51
49
|
end
|
52
50
|
end
|
@@ -115,9 +113,11 @@ module Watir
|
|
115
113
|
end
|
116
114
|
|
117
115
|
def locate
|
118
|
-
handle = @
|
119
|
-
|
120
|
-
|
116
|
+
handle = if @selector.has_key?(:index)
|
117
|
+
@driver.window_handles[Integer(@selector[:index])]
|
118
|
+
else
|
119
|
+
@driver.window_handles.find { |handle| matches?(handle) }
|
120
|
+
end
|
121
121
|
|
122
122
|
handle or raise Exception::NoMatchingWindowFoundException, @selector.inspect
|
123
123
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: watir-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jari Bakken
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-04-04 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|