selenium-webdriver 0.0.29 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +15 -1
- data/lib/selenium-client.rb +2 -0
- data/lib/selenium/client.rb +30 -0
- data/lib/selenium/client/base.rb +118 -0
- data/lib/selenium/client/driver.rb +10 -0
- data/lib/selenium/client/errors.rb +9 -0
- data/lib/selenium/client/extensions.rb +118 -0
- data/lib/selenium/client/idiomatic.rb +488 -0
- data/lib/selenium/client/javascript_expression_builder.rb +116 -0
- data/lib/selenium/client/javascript_frameworks/jquery.rb +13 -0
- data/lib/selenium/client/javascript_frameworks/prototype.rb +13 -0
- data/lib/selenium/client/legacy_driver.rb +1711 -0
- data/lib/selenium/client/protocol.rb +104 -0
- data/lib/selenium/client/selenium_helper.rb +34 -0
- data/lib/selenium/rake/server_task.rb +131 -0
- data/lib/selenium/server.rb +114 -0
- data/lib/selenium/webdriver.rb +3 -2
- data/lib/selenium/webdriver/android.rb +9 -0
- data/lib/selenium/webdriver/android/bridge.rb +45 -0
- data/lib/selenium/webdriver/chrome/extension.zip +0 -0
- data/lib/selenium/webdriver/chrome/launcher.rb +6 -3
- data/lib/selenium/webdriver/common.rb +2 -0
- data/lib/selenium/webdriver/common/driver.rb +8 -4
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +28 -0
- data/lib/selenium/webdriver/common/file_reaper.rb +10 -0
- data/lib/selenium/webdriver/common/proxy.rb +119 -0
- data/lib/selenium/webdriver/common/socket_poller.rb +27 -9
- data/lib/selenium/webdriver/firefox/binary.rb +8 -5
- data/lib/selenium/webdriver/firefox/bridge.rb +2 -3
- data/lib/selenium/webdriver/firefox/extension.rb +17 -14
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +8 -2
- data/lib/selenium/webdriver/firefox/profile.rb +45 -1
- data/lib/selenium/webdriver/firefox/socket_lock.rb +1 -5
- data/lib/selenium/webdriver/ie/bridge.rb +3 -3
- data/lib/selenium/webdriver/ie/native/win32/InternetExplorerDriver.dll +0 -0
- data/lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll +0 -0
- data/lib/selenium/webdriver/iphone.rb +9 -0
- data/lib/selenium/webdriver/iphone/bridge.rb +34 -0
- data/lib/selenium/webdriver/remote/bridge.rb +0 -1
- data/lib/selenium/webdriver/remote/capabilities.rb +46 -13
- data/lib/selenium/webdriver/remote/commands.rb +3 -4
- data/lib/selenium/webdriver/remote/http/common.rb +1 -1
- data/lib/selenium/webdriver/remote/http/default.rb +7 -1
- metadata +42 -7
@@ -55,11 +55,7 @@ module Selenium
|
|
55
55
|
|
56
56
|
def can_lock?
|
57
57
|
@server = TCPServer.new(HOST, @port)
|
58
|
-
|
59
|
-
# make sure the fd is not inherited by exec()'d processes
|
60
|
-
if defined? Fcntl::FD_CLOEXEC
|
61
|
-
@server.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
62
|
-
end
|
58
|
+
ChildProcess.close_on_exec @server
|
63
59
|
|
64
60
|
true
|
65
61
|
rescue SocketError, Errno::EADDRINUSE => ex
|
@@ -9,14 +9,14 @@ module Selenium
|
|
9
9
|
class Bridge
|
10
10
|
include Util
|
11
11
|
|
12
|
-
def initialize
|
12
|
+
def initialize(opts = {})
|
13
13
|
ptr_ref = FFI::MemoryPointer.new :pointer
|
14
14
|
|
15
15
|
check_error_code Lib.wdNewDriverInstance(ptr_ref),
|
16
16
|
"could not create driver instance"
|
17
17
|
|
18
18
|
@driver_pointer = ptr_ref.get_pointer(0)
|
19
|
-
@speed = :fast
|
19
|
+
@speed = opts[:speed] || :fast
|
20
20
|
end
|
21
21
|
|
22
22
|
def browser
|
@@ -591,4 +591,4 @@ module Selenium
|
|
591
591
|
end # Bridge
|
592
592
|
end # IE
|
593
593
|
end # WebDriver
|
594
|
-
end # Selenium
|
594
|
+
end # Selenium
|
Binary file
|
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Selenium
|
2
|
+
module WebDriver
|
3
|
+
module IPhone
|
4
|
+
class Bridge < Remote::Bridge
|
5
|
+
|
6
|
+
DEFAULT_URL = "http://localhost:3001/hub/"
|
7
|
+
|
8
|
+
def initialize(opts = nil)
|
9
|
+
if opts
|
10
|
+
super
|
11
|
+
else
|
12
|
+
super(
|
13
|
+
:url => DEFAULT_URL,
|
14
|
+
:desired_capabilities => capabilities
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def browser
|
20
|
+
:iphone
|
21
|
+
end
|
22
|
+
|
23
|
+
def driver_extensions
|
24
|
+
[]
|
25
|
+
end
|
26
|
+
|
27
|
+
def capabilities
|
28
|
+
@capabilities ||= Remote::Capabilities.iphone
|
29
|
+
end
|
30
|
+
|
31
|
+
end # Bridge
|
32
|
+
end # IPhone
|
33
|
+
end # WebDriver
|
34
|
+
end # Selenium
|
@@ -1,25 +1,28 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
3
|
module Remote
|
4
|
-
|
5
4
|
#
|
6
5
|
# Specification of the desired and/or actual capabilities of the browser that the
|
7
6
|
# server is being asked to create.
|
8
7
|
#
|
9
8
|
class Capabilities
|
10
9
|
|
10
|
+
attr_reader :proxy
|
11
|
+
|
11
12
|
attr_accessor :css_selectors_enabled,
|
12
13
|
:javascript_enabled,
|
13
14
|
:native_events,
|
14
15
|
:platform,
|
15
16
|
:takes_screenshot,
|
17
|
+
:rotatable,
|
16
18
|
:version,
|
17
19
|
:browser_name
|
18
20
|
|
19
21
|
alias_method :css_selectors_enabled?, :css_selectors_enabled
|
20
|
-
alias_method :javascript_enabled
|
21
|
-
alias_method :native_events
|
22
|
-
alias_method :takes_screenshot
|
22
|
+
alias_method :javascript_enabled? , :javascript_enabled
|
23
|
+
alias_method :native_events? , :native_events
|
24
|
+
alias_method :takes_screenshot? , :takes_screenshot
|
25
|
+
alias_method :rotatable? , :rotatable
|
23
26
|
|
24
27
|
#
|
25
28
|
# Convenience methods for the common choices.
|
@@ -55,8 +58,9 @@ module Selenium
|
|
55
58
|
|
56
59
|
def iphone(opts = {})
|
57
60
|
new({
|
58
|
-
:browser_name
|
59
|
-
:platform
|
61
|
+
:browser_name => "iphone",
|
62
|
+
:platform => :mac,
|
63
|
+
:javascript_enabled => true
|
60
64
|
}.merge(opts))
|
61
65
|
end
|
62
66
|
|
@@ -69,8 +73,10 @@ module Selenium
|
|
69
73
|
|
70
74
|
def android(opts = {})
|
71
75
|
new({
|
72
|
-
:browser_name
|
73
|
-
:platform
|
76
|
+
:browser_name => "android",
|
77
|
+
:platform => :android,
|
78
|
+
:rotatable => true,
|
79
|
+
:takes_screenshot => true
|
74
80
|
}.merge(opts))
|
75
81
|
end
|
76
82
|
|
@@ -86,7 +92,9 @@ module Selenium
|
|
86
92
|
:javascript_enabled => data["javascriptEnabled"],
|
87
93
|
:css_selectors_enabled => data["cssSelectorsEnabled"],
|
88
94
|
:takes_screenshot => data["takesScreenshot"],
|
89
|
-
:native_events => data["nativeEvents"]
|
95
|
+
:native_events => data["nativeEvents"],
|
96
|
+
:rotatable => data["rotatable"],
|
97
|
+
:proxy => (Proxy.json_create(data['proxy']) if data['proxy'])
|
90
98
|
)
|
91
99
|
end
|
92
100
|
end
|
@@ -98,6 +106,7 @@ module Selenium
|
|
98
106
|
# @option :css_selectors_enabled [Boolean] does the driver support CSS selectors?
|
99
107
|
# @option :takes_screenshot [Boolean] can this driver take screenshots?
|
100
108
|
# @option :native_events [Boolean] does this driver use native events?
|
109
|
+
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
|
101
110
|
#
|
102
111
|
# @api public
|
103
112
|
#
|
@@ -110,28 +119,52 @@ module Selenium
|
|
110
119
|
@css_selectors_enabled = opts[:css_selectors_enabled] || false
|
111
120
|
@takes_screenshot = opts[:takes_screenshot] || false
|
112
121
|
@native_events = opts[:native_events] || false
|
122
|
+
@rotatable = opts[:rotatable] || false
|
123
|
+
|
124
|
+
self.proxy = opts[:proxy]
|
125
|
+
end
|
126
|
+
|
127
|
+
def proxy=(proxy)
|
128
|
+
case proxy
|
129
|
+
when Hash
|
130
|
+
@proxy = Proxy.new(proxy)
|
131
|
+
when Proxy, nil
|
132
|
+
@proxy = proxy
|
133
|
+
else
|
134
|
+
raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
|
135
|
+
end
|
113
136
|
end
|
114
137
|
|
115
|
-
#
|
116
138
|
# @api private
|
117
139
|
#
|
118
140
|
|
119
141
|
def as_json(opts = nil)
|
120
|
-
{
|
142
|
+
hash = {
|
121
143
|
"browserName" => browser_name,
|
122
144
|
"version" => version,
|
123
145
|
"platform" => platform.to_s.upcase,
|
124
146
|
"javascriptEnabled" => javascript_enabled?,
|
125
|
-
"
|
147
|
+
"cssSelectorsEnabled" => css_selectors_enabled?,
|
126
148
|
"takesScreenshot" => takes_screenshot?,
|
127
|
-
"nativeEvents" => native_events
|
149
|
+
"nativeEvents" => native_events?,
|
150
|
+
"rotatable" => rotatable?
|
128
151
|
}
|
152
|
+
|
153
|
+
hash["proxy"] = proxy.as_json if proxy
|
154
|
+
|
155
|
+
hash
|
129
156
|
end
|
130
157
|
|
131
158
|
def to_json(*args)
|
132
159
|
as_json.to_json(*args)
|
133
160
|
end
|
134
161
|
|
162
|
+
def ==(other)
|
163
|
+
return false unless other.kind_of? self.class
|
164
|
+
as_json == other.as_json
|
165
|
+
end
|
166
|
+
alias_method :eql?, :==
|
167
|
+
|
135
168
|
end # Capabilities
|
136
169
|
end # Remote
|
137
170
|
end # WebDriver
|
@@ -53,11 +53,10 @@ class Selenium::WebDriver::Remote::Bridge
|
|
53
53
|
command :hoverOverElement, :post, "session/:session_id/element/:id/hover"
|
54
54
|
command :dragElement, :post, "session/:session_id/element/:id/drag"
|
55
55
|
command :getElementValueOfCssProperty, :get, "session/:session_id/element/:id/css/:property_name"
|
56
|
-
|
57
56
|
command :close, :delete, "session/:session_id/window"
|
58
57
|
command :getElementText, :get, "session/:session_id/element/:id/text"
|
59
58
|
command :getVisible, :get, "session/:session_id/visible"
|
60
59
|
command :setVisible, :post, "session/:session_id/visible"
|
61
|
-
|
62
|
-
|
63
|
-
end
|
60
|
+
command :getScreenOrientation, :get, "session/:session_id/orientation"
|
61
|
+
command :setScreenOrientation, :post, "session/:session_id/orientation"
|
62
|
+
end
|
@@ -5,7 +5,7 @@ module Selenium
|
|
5
5
|
class Common
|
6
6
|
MAX_REDIRECTS = 20 # same as chromium/gecko
|
7
7
|
CONTENT_TYPE = "application/json"
|
8
|
-
DEFAULT_HEADERS = { "Accept" => CONTENT_TYPE
|
8
|
+
DEFAULT_HEADERS = { "Accept" => CONTENT_TYPE }
|
9
9
|
|
10
10
|
class << self
|
11
11
|
attr_accessor :timeout
|
@@ -52,7 +52,13 @@ module Selenium
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def new_request_for(verb, url, headers)
|
55
|
-
Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
|
55
|
+
req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
|
56
|
+
|
57
|
+
if @server_url.userinfo
|
58
|
+
req.basic_auth @server_url.user, @server_url.password
|
59
|
+
end
|
60
|
+
|
61
|
+
req
|
56
62
|
end
|
57
63
|
|
58
64
|
end # Default
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.29
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jari Bakken
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-11 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -46,13 +46,13 @@ dependencies:
|
|
46
46
|
prerelease: false
|
47
47
|
requirement: &id003 !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- - "
|
49
|
+
- - "="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
segments:
|
52
52
|
- 0
|
53
|
-
-
|
54
|
-
-
|
55
|
-
version: 0.
|
53
|
+
- 1
|
54
|
+
- 4
|
55
|
+
version: 0.1.4
|
56
56
|
type: :runtime
|
57
57
|
version_requirements: *id003
|
58
58
|
- !ruby/object:Gem::Dependency
|
@@ -96,6 +96,20 @@ dependencies:
|
|
96
96
|
version: "1.0"
|
97
97
|
type: :development
|
98
98
|
version_requirements: *id006
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: ci_reporter
|
101
|
+
prerelease: false
|
102
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ~>
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 1
|
108
|
+
- 6
|
109
|
+
- 2
|
110
|
+
version: 1.6.2
|
111
|
+
type: :development
|
112
|
+
version_requirements: *id007
|
99
113
|
description: WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application.
|
100
114
|
email: jari.bakken@gmail.com
|
101
115
|
executables: []
|
@@ -105,13 +119,31 @@ extensions: []
|
|
105
119
|
extra_rdoc_files: []
|
106
120
|
|
107
121
|
files:
|
122
|
+
- lib/selenium-client.rb
|
108
123
|
- lib/selenium-webdriver.rb
|
124
|
+
- lib/selenium/client.rb
|
125
|
+
- lib/selenium/server.rb
|
109
126
|
- lib/selenium/webdriver.rb
|
127
|
+
- lib/selenium/client/base.rb
|
128
|
+
- lib/selenium/client/driver.rb
|
129
|
+
- lib/selenium/client/errors.rb
|
130
|
+
- lib/selenium/client/extensions.rb
|
131
|
+
- lib/selenium/client/idiomatic.rb
|
132
|
+
- lib/selenium/client/javascript_expression_builder.rb
|
133
|
+
- lib/selenium/client/legacy_driver.rb
|
134
|
+
- lib/selenium/client/protocol.rb
|
135
|
+
- lib/selenium/client/selenium_helper.rb
|
136
|
+
- lib/selenium/client/javascript_frameworks/jquery.rb
|
137
|
+
- lib/selenium/client/javascript_frameworks/prototype.rb
|
138
|
+
- lib/selenium/rake/server_task.rb
|
139
|
+
- lib/selenium/webdriver/android.rb
|
110
140
|
- lib/selenium/webdriver/chrome.rb
|
111
141
|
- lib/selenium/webdriver/common.rb
|
112
142
|
- lib/selenium/webdriver/firefox.rb
|
113
143
|
- lib/selenium/webdriver/ie.rb
|
144
|
+
- lib/selenium/webdriver/iphone.rb
|
114
145
|
- lib/selenium/webdriver/remote.rb
|
146
|
+
- lib/selenium/webdriver/android/bridge.rb
|
115
147
|
- lib/selenium/webdriver/chrome/bridge.rb
|
116
148
|
- lib/selenium/webdriver/chrome/command_executor.rb
|
117
149
|
- lib/selenium/webdriver/chrome/extension.zip
|
@@ -126,6 +158,7 @@ files:
|
|
126
158
|
- lib/selenium/webdriver/common/navigation.rb
|
127
159
|
- lib/selenium/webdriver/common/options.rb
|
128
160
|
- lib/selenium/webdriver/common/platform.rb
|
161
|
+
- lib/selenium/webdriver/common/proxy.rb
|
129
162
|
- lib/selenium/webdriver/common/socket_poller.rb
|
130
163
|
- lib/selenium/webdriver/common/target_locator.rb
|
131
164
|
- lib/selenium/webdriver/common/timeouts.rb
|
@@ -133,6 +166,7 @@ files:
|
|
133
166
|
- lib/selenium/webdriver/common/zipper.rb
|
134
167
|
- lib/selenium/webdriver/common/core_ext/dir.rb
|
135
168
|
- lib/selenium/webdriver/common/core_ext/string.rb
|
169
|
+
- lib/selenium/webdriver/common/driver_extensions/rotatable.rb
|
136
170
|
- lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
|
137
171
|
- lib/selenium/webdriver/firefox/binary.rb
|
138
172
|
- lib/selenium/webdriver/firefox/bridge.rb
|
@@ -150,6 +184,7 @@ files:
|
|
150
184
|
- lib/selenium/webdriver/ie/util.rb
|
151
185
|
- lib/selenium/webdriver/ie/native/win32/InternetExplorerDriver.dll
|
152
186
|
- lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll
|
187
|
+
- lib/selenium/webdriver/iphone/bridge.rb
|
153
188
|
- lib/selenium/webdriver/remote/bridge.rb
|
154
189
|
- lib/selenium/webdriver/remote/capabilities.rb
|
155
190
|
- lib/selenium/webdriver/remote/commands.rb
|