operawatir 0.5.pre1-jruby → 0.5.pre2-jruby
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/CHANGES +54 -1
- data/VERSION +1 -1
- data/bin/operawatir +16 -4
- data/lib/operadriver/{operadriver-v0.6.1.jar → operadriver-v0.7.1.jar} +0 -0
- data/lib/operawatir.rb +3 -1
- data/lib/operawatir/browser.rb +17 -12
- data/lib/operawatir/compat/window.rb +3 -2
- data/lib/operawatir/element.rb +1 -1
- data/lib/operawatir/utils.rb +31 -0
- data/operawatir.gemspec +5 -3
- data/spec/operawatir/core/utils_spec.rb +47 -0
- metadata +5 -3
data/CHANGES
CHANGED
@@ -1,4 +1,57 @@
|
|
1
|
-
v0.5.
|
1
|
+
v0.5.pre2 2011-09-06
|
2
|
+
|
3
|
+
[NEW FEATURES]
|
4
|
+
|
5
|
+
* Added browser utility service as Browser#utils, implementing the following
|
6
|
+
new method calls:
|
7
|
+
|
8
|
+
Utils#core_version, returning the core version
|
9
|
+
Utils#os, returning the browser's OS
|
10
|
+
Utils#product, returning product type (desktop/core/mobile)
|
11
|
+
Utils#binary_path, returning full path to Opera binary
|
12
|
+
Utils#user_agent, returning User-Agent string
|
13
|
+
Utils#pid, returning the browser's PID if available
|
14
|
+
|
15
|
+
(andreastt)
|
16
|
+
|
17
|
+
* Implementing ability to enable verbose logging in operawatir. Added
|
18
|
+
following new command-line switches to the operawatir binary:
|
19
|
+
|
20
|
+
--debug=LEVEL (or -d for short), for specifying logging level
|
21
|
+
--log=FILE, for specifying sending the logging to a file
|
22
|
+
|
23
|
+
Available logging levels are: SEVERE (highest), WARNING, INFO, CONFIG,
|
24
|
+
FINE, FINER, FINEST (lowest), ALL. Default is INFO. See `operawatir
|
25
|
+
--help` for more information.
|
26
|
+
|
27
|
+
(andreastt)
|
28
|
+
|
29
|
+
[ENHANCEMENTS]
|
30
|
+
|
31
|
+
* Now using DesiredCapabilities from OperaDriver v0.7 instead of
|
32
|
+
OperaDriverSettings. (andreastt)
|
33
|
+
|
34
|
+
[BUG FIXES]
|
35
|
+
|
36
|
+
* initMouseEvent in Element#fire_event is now clicking clientX and clientY
|
37
|
+
instead of relying on internal driver locators. (andreastt)
|
38
|
+
|
39
|
+
* Compat::Window#show_frames now returns a string instead of writing to
|
40
|
+
STDOUT. (andreastt)
|
41
|
+
|
42
|
+
* Browser#quit was calling OperaDriver.shutdown() which is now deprecated.
|
43
|
+
Fixed by now calling OperaDriver.quit() instead. (andreastt)
|
44
|
+
|
45
|
+
* `operawatir --help` was broken, fixed by converting OptionParse object to a
|
46
|
+
String. (andreastt)
|
47
|
+
|
48
|
+
[OTHER]
|
49
|
+
|
50
|
+
* Upgraded to OperaDriver v0.7.1. (andreastt)
|
51
|
+
|
52
|
+
* Added tests for new Utils interface. (andreastt)
|
53
|
+
|
54
|
+
v0.5.pre1 2011-08-31
|
2
55
|
|
3
56
|
[API CHANGES]
|
4
57
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.pre2
|
data/bin/operawatir
CHANGED
@@ -27,7 +27,7 @@ begin
|
|
27
27
|
Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [--binary=BINARY]
|
28
28
|
[-a|--args=ARGUMENTS] [-q|--no-quit] [--opera-idle] [-b|--backtrace]
|
29
29
|
[--no-color] [-t|--tag=TAG] [-f|--format=FORMAT] [-o|--out=FILE]
|
30
|
-
[-h|--help] [-v|--version] FILES
|
30
|
+
[-d|--debug=LEVEL] [--log=FILE] [-h|--help] [-v|--version] FILES
|
31
31
|
EOS
|
32
32
|
|
33
33
|
opts.separator ''
|
@@ -90,16 +90,28 @@ EOS
|
|
90
90
|
opts.separator ''
|
91
91
|
opts.separator 'Common options:'
|
92
92
|
|
93
|
+
opts.on_tail('-d', '--debug=LEVEL', 'The logging level to use. Available levels: SEVERE',
|
94
|
+
'(highest), WARNING, INFO (default), CONFIG, FINE,',
|
95
|
+
'FINER, FINEST (lowest), ALL') do |l|
|
96
|
+
available_levels = ['SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST', 'ALL']
|
97
|
+
raise OptionParser::InvalidArgument, l.to_s.inspect unless available_levels.include?(l)
|
98
|
+
@options[:logging_level] = l
|
99
|
+
end
|
100
|
+
|
101
|
+
opts.on_tail('--log=FILE', 'Output the log to a file') do |f|
|
102
|
+
@options[:logging_file] = f
|
103
|
+
end
|
104
|
+
|
93
105
|
opts.on_tail('-h', '--help', 'Show this message') do
|
94
|
-
abort opts
|
106
|
+
abort opts.to_s
|
95
107
|
end
|
96
108
|
|
97
109
|
opts.on_tail('-v', '--version', 'Show version') do
|
98
110
|
abort "OperaWatir version #{OperaWatir.version}"
|
99
111
|
end
|
100
112
|
end.parse!(ARGV)
|
101
|
-
rescue OptionParser::
|
102
|
-
abort "operawatir:
|
113
|
+
rescue OptionParser::ParseError => e
|
114
|
+
abort "operawatir: #{e}"
|
103
115
|
end
|
104
116
|
|
105
117
|
if ARGV.empty?
|
Binary file
|
data/lib/operawatir.rb
CHANGED
@@ -5,12 +5,13 @@ require 'java'
|
|
5
5
|
include Java
|
6
6
|
|
7
7
|
%w(commons-jxpath-1.3.jar protobuf-java-2.3.0.jar selenium-java-head.jar
|
8
|
-
operadriver-v0.
|
8
|
+
operadriver-v0.7.1.jar commons-io-2.0.1.jar guava-r09.jar).each { |jar| require "operadriver/#{jar}" }
|
9
9
|
|
10
10
|
include_class org.openqa.selenium.WebDriver
|
11
11
|
include_class org.openqa.selenium.remote.RemoteWebElement
|
12
12
|
include_class org.openqa.selenium.NoSuchElementException
|
13
13
|
include_class org.openqa.selenium.interactions.Actions
|
14
|
+
include_class org.openqa.selenium.remote.DesiredCapabilities
|
14
15
|
include_class com.opera.core.systems.OperaDriver
|
15
16
|
include_class com.opera.core.systems.OperaWebElement
|
16
17
|
include_class com.opera.core.systems.settings.OperaDriverSettings
|
@@ -60,6 +61,7 @@ require 'operawatir/screenshot'
|
|
60
61
|
require 'operawatir/preferences'
|
61
62
|
require 'operawatir/spatnav'
|
62
63
|
require 'operawatir/actions'
|
64
|
+
require 'operawatir/utils'
|
63
65
|
|
64
66
|
require 'operawatir/exceptions'
|
65
67
|
require 'operawatir/selector'
|
data/lib/operawatir/browser.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
class OperaWatir::Browser
|
3
3
|
include Deprecated
|
4
4
|
|
5
|
-
attr_accessor :driver, :active_window, :preferences, :keys, :spatnav
|
5
|
+
attr_accessor :driver, :active_window, :preferences, :keys, :spatnav, :utils
|
6
6
|
|
7
7
|
def self.settings=(settings={})
|
8
|
-
@
|
8
|
+
@desired_capabilities = nil # Bust cache
|
9
9
|
@settings = settings
|
10
10
|
end
|
11
11
|
|
@@ -22,11 +22,12 @@ class OperaWatir::Browser
|
|
22
22
|
def initialize
|
23
23
|
OperaWatir.compatibility! unless OperaWatir.api >= 3
|
24
24
|
|
25
|
-
self.driver = OperaDriver.new(self.class.
|
25
|
+
self.driver = OperaDriver.new(self.class.desired_capabilities)
|
26
26
|
self.active_window = OperaWatir::Window.new(self)
|
27
27
|
self.preferences = OperaWatir::Preferences.new(self)
|
28
28
|
self.keys = OperaWatir::Keys.new(self)
|
29
29
|
self.spatnav = OperaWatir::Spatnav.new(self)
|
30
|
+
self.utils = OperaWatir::Utils.new(self)
|
30
31
|
end
|
31
32
|
|
32
33
|
alias_method :window, :active_window
|
@@ -48,7 +49,7 @@ class OperaWatir::Browser
|
|
48
49
|
|
49
50
|
# Instruct the browser instance to quit and shut down.
|
50
51
|
def quit
|
51
|
-
driver.
|
52
|
+
driver.quit
|
52
53
|
end
|
53
54
|
|
54
55
|
# Get the version number of the driver. This _is not_ the same as
|
@@ -99,6 +100,7 @@ class OperaWatir::Browser
|
|
99
100
|
def opera_action(name, *args)
|
100
101
|
driver.operaAction(name, args.to_java(:string))
|
101
102
|
end
|
103
|
+
|
102
104
|
deprecated :opera_action
|
103
105
|
|
104
106
|
# Full list of available Opera actions in the Opera build you're
|
@@ -111,6 +113,7 @@ class OperaWatir::Browser
|
|
111
113
|
def opera_action_list
|
112
114
|
driver.getOperaActionList.to_a
|
113
115
|
end
|
116
|
+
|
114
117
|
deprecated :opera_action_list
|
115
118
|
|
116
119
|
# Selects all content in the currently focused element. Equivalent
|
@@ -196,14 +199,16 @@ class OperaWatir::Browser
|
|
196
199
|
|
197
200
|
private
|
198
201
|
|
199
|
-
def self.
|
200
|
-
@
|
201
|
-
s.
|
202
|
-
s.
|
203
|
-
s.
|
204
|
-
s.
|
205
|
-
s.
|
206
|
-
s.
|
202
|
+
def self.desired_capabilities
|
203
|
+
@desired_capabilities ||= DesiredCapabilities.new.tap { |s|
|
204
|
+
s.setCapability('opera.logging.level', self.settings[:logging_level]) if self.settings[:logging_level]
|
205
|
+
s.setCapability('opera.logging.file', self.settings[:logging_file]) if self.settings[:logging_file]
|
206
|
+
s.setCapability('opera.autostart', false) if self.settings[:manual]
|
207
|
+
s.setCapability('opera.launcher', self.settings[:launcher]) if self.settings[:launcher]
|
208
|
+
s.setCapability('opera.binary', self.settings[:path]) if self.settings[:path]
|
209
|
+
s.setCapability('opera.arguments', self.settings[:args].to_s) if self.settings[:args]
|
210
|
+
s.setCapability('opera.no_quit', true) if self.settings[:no_quit]
|
211
|
+
s.setCapability('opera.idle', true) if self.settings[:opera_idle] or ENV['OPERA_IDLE'].truthy?
|
207
212
|
}
|
208
213
|
end
|
209
214
|
|
@@ -67,8 +67,9 @@ module OperaWatir
|
|
67
67
|
|
68
68
|
def show_frames
|
69
69
|
frames = driver.list_frames
|
70
|
-
|
71
|
-
frames.each_with_index { |frame, i|
|
70
|
+
text = "There are #{frames.length.to_s} frames\n"
|
71
|
+
frames.each_with_index { |frame, i| text << "frame index: #{(i.to_i + 1).to_s} name: #{frame.to_s}\n" }
|
72
|
+
text
|
72
73
|
end
|
73
74
|
|
74
75
|
end
|
data/lib/operawatir/element.rb
CHANGED
@@ -200,7 +200,7 @@ class OperaWatir::Element
|
|
200
200
|
init = "initEvent(\"#{event.to_s}\", true, true)"
|
201
201
|
when :click, :dblclick, :mousedown, :mousemove, :mouseout, :mouseover, :mouseup
|
202
202
|
type = 'MouseEvents'
|
203
|
-
init = "initMouseEvent(\"#{event.to_s}\", true, true, window, 1, 0, 0,
|
203
|
+
init = "initMouseEvent(\"#{event.to_s}\", true, true, window, 1, 0, 0, #{x}, #{y}, false, false, false, false, 0, null)"
|
204
204
|
else
|
205
205
|
raise Exceptions::NotImplementedException, "Event on#{event} is not a valid ECMAscript event for OperaWatir."
|
206
206
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class OperaWatir::Utils
|
2
|
+
|
3
|
+
def initialize(browser)
|
4
|
+
@utils = browser.driver.utils
|
5
|
+
end
|
6
|
+
|
7
|
+
def core_version
|
8
|
+
@utils.getCoreVersion
|
9
|
+
end
|
10
|
+
|
11
|
+
def os
|
12
|
+
@utils.getOS
|
13
|
+
end
|
14
|
+
|
15
|
+
def product
|
16
|
+
@utils.getProduct
|
17
|
+
end
|
18
|
+
|
19
|
+
def binary_path
|
20
|
+
@utils.getBinaryPath
|
21
|
+
end
|
22
|
+
|
23
|
+
def user_agent
|
24
|
+
@utils.getUserAgent
|
25
|
+
end
|
26
|
+
|
27
|
+
def pid
|
28
|
+
@utils.getPID
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/operawatir.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{operawatir}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.pre2"
|
9
9
|
s.platform = %q{jruby}
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Andreas Tolf Tolfsen", "Chris Lloyd", "Stuart Knightley", "Deniz Turkoglu"]
|
13
|
-
s.date = %q{2011-
|
13
|
+
s.date = %q{2011-09-06}
|
14
14
|
s.description = %q{ OperaWatir is a part of the Watir (pronounced water) family of
|
15
15
|
free software Ruby libraries for automating web browsers.
|
16
16
|
OperaWatir provides a querying engine and Ruby bindings for a
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
"lib/operadriver/commons-io-2.0.1.jar",
|
41
41
|
"lib/operadriver/commons-jxpath-1.3.jar",
|
42
42
|
"lib/operadriver/guava-r09.jar",
|
43
|
-
"lib/operadriver/operadriver-v0.
|
43
|
+
"lib/operadriver/operadriver-v0.7.1.jar",
|
44
44
|
"lib/operadriver/protobuf-java-2.3.0.jar",
|
45
45
|
"lib/operadriver/selenium-java-head.jar",
|
46
46
|
"lib/operawatir.rb",
|
@@ -94,6 +94,7 @@ Gem::Specification.new do |s|
|
|
94
94
|
"lib/operawatir/screenshot.rb",
|
95
95
|
"lib/operawatir/selector.rb",
|
96
96
|
"lib/operawatir/spatnav.rb",
|
97
|
+
"lib/operawatir/utils.rb",
|
97
98
|
"lib/operawatir/version.rb",
|
98
99
|
"lib/operawatir/window.rb",
|
99
100
|
"operawatir.gemspec",
|
@@ -117,6 +118,7 @@ Gem::Specification.new do |s|
|
|
117
118
|
"spec/operawatir/core/preferences_spec.rb",
|
118
119
|
"spec/operawatir/core/screenshot_spec.rb",
|
119
120
|
"spec/operawatir/core/spatnav_spec.rb",
|
121
|
+
"spec/operawatir/core/utils_spec.rb",
|
120
122
|
"spec/operawatir/core/window_spec.rb",
|
121
123
|
"spec/operawatir/desktop/desktopbrowser_spec.rb",
|
122
124
|
"spec/operawatir/desktop/quickaddressfield_spec.rb",
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../../watirspec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe OperaWatir::Utils do
|
4
|
+
|
5
|
+
before(:all) { @utils = browser.utils }
|
6
|
+
|
7
|
+
describe '#core_version' do
|
8
|
+
it 'it matches a core version number' do
|
9
|
+
@utils.core_version.should match /\d+\.\d+\.\d+/
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#os' do
|
14
|
+
it 'is not empty' do
|
15
|
+
@utils.os.should_not be_empty
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#product' do
|
20
|
+
it 'is not unknown' do
|
21
|
+
@utils.product.should_not include 'unknown'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'is known' do
|
25
|
+
@utils.product.should match /core-gogi|desktop/
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#binary_path' do
|
30
|
+
it 'is not empty' do
|
31
|
+
@utils.binary_path.should_not be_empty
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#user_agent' do
|
36
|
+
it 'is a User-Agent string' do
|
37
|
+
@utils.user_agent.should match /Opera\/\d+\.\d+.+/
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#pid' do
|
42
|
+
it 'is greater than zero' do
|
43
|
+
@utils.pid.should > 0
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: operawatir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 4
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.pre2
|
6
6
|
platform: jruby
|
7
7
|
authors:
|
8
8
|
- Andreas Tolf Tolfsen
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2011-
|
16
|
+
date: 2011-09-06 00:00:00 +02:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -288,7 +288,7 @@ files:
|
|
288
288
|
- lib/operadriver/commons-io-2.0.1.jar
|
289
289
|
- lib/operadriver/commons-jxpath-1.3.jar
|
290
290
|
- lib/operadriver/guava-r09.jar
|
291
|
-
- lib/operadriver/operadriver-v0.
|
291
|
+
- lib/operadriver/operadriver-v0.7.1.jar
|
292
292
|
- lib/operadriver/protobuf-java-2.3.0.jar
|
293
293
|
- lib/operadriver/selenium-java-head.jar
|
294
294
|
- lib/operawatir.rb
|
@@ -342,6 +342,7 @@ files:
|
|
342
342
|
- lib/operawatir/screenshot.rb
|
343
343
|
- lib/operawatir/selector.rb
|
344
344
|
- lib/operawatir/spatnav.rb
|
345
|
+
- lib/operawatir/utils.rb
|
345
346
|
- lib/operawatir/version.rb
|
346
347
|
- lib/operawatir/window.rb
|
347
348
|
- operawatir.gemspec
|
@@ -365,6 +366,7 @@ files:
|
|
365
366
|
- spec/operawatir/core/preferences_spec.rb
|
366
367
|
- spec/operawatir/core/screenshot_spec.rb
|
367
368
|
- spec/operawatir/core/spatnav_spec.rb
|
369
|
+
- spec/operawatir/core/utils_spec.rb
|
368
370
|
- spec/operawatir/core/window_spec.rb
|
369
371
|
- spec/operawatir/desktop/desktopbrowser_spec.rb
|
370
372
|
- spec/operawatir/desktop/quickaddressfield_spec.rb
|