selenium-selenese 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +8 -109
- data/lib/selenium/client/protocol.rb +1 -1
- data/lib/selenium/selenese.rb +24 -0
- data/vendor/selenium-server.jar +0 -0
- metadata +33 -47
data/README.markdown
CHANGED
@@ -14,27 +14,22 @@ Mission
|
|
14
14
|
Install It
|
15
15
|
==========
|
16
16
|
|
17
|
-
The easiest way to install the install selenium-
|
17
|
+
The easiest way to install the install selenium-selenese using RubyGems:
|
18
18
|
|
19
|
-
sudo gem install selenium-
|
19
|
+
sudo gem install selenium-selenese
|
20
20
|
|
21
21
|
Features
|
22
22
|
========
|
23
23
|
|
24
24
|
* Backward compatible with the old-fashioned, XSL generated Selenium Ruby API.
|
25
|
-
See [the generated driver](http://seleni-selenese.rubyforge.org/classes/Selenium/Client/GeneratedDriver.html) to get an extensive reference.
|
26
25
|
|
27
26
|
* Idiomatic interface to the Selenium API.
|
28
|
-
See [the Idiomatic module](http://seleni-selenese.rubyforge.org/classes/Selenium/Client/Idiomatic.html)
|
29
|
-
for more details.
|
30
27
|
|
31
28
|
* Convenience methods for AJAX.
|
32
|
-
See the [Extensions](http://seleni-selenese.rubyforge.org/classes/Selenium/Client/Extensions.html)
|
33
|
-
for more details.
|
34
29
|
|
35
30
|
* Flexible wait semantics inline with the trigerring action. e.g.
|
36
31
|
|
37
|
-
Check out the `click`, `go_back` and `wait_for` methods of the [Idiomatic Module]
|
32
|
+
Check out the `click`, `go_back` and `wait_for` methods of the [Idiomatic Module]
|
38
33
|
|
39
34
|
* Leveraging latest innovations in Selenium Remote Control (screenshots, log captures, ...)
|
40
35
|
|
@@ -45,7 +40,7 @@ Features
|
|
45
40
|
Plain API
|
46
41
|
=========
|
47
42
|
|
48
|
-
|
43
|
+
selenium-selenese is just a plain Ruby API, so you can use it wherever you can use Ruby.
|
49
44
|
|
50
45
|
To used the new API just require the client driver:
|
51
46
|
|
@@ -53,7 +48,7 @@ Plain API
|
|
53
48
|
require "selenium/selenese"
|
54
49
|
|
55
50
|
For instance
|
56
|
-
to write a little Ruby script using selenium-
|
51
|
+
to write a little Ruby script using selenium-selenese you could write something like:
|
57
52
|
|
58
53
|
#!/usr/bin/env ruby
|
59
54
|
#
|
@@ -64,8 +59,6 @@ Plain API
|
|
64
59
|
|
65
60
|
begin
|
66
61
|
@browser = Selenium::Client::Driver.new \
|
67
|
-
:host => "localhost",
|
68
|
-
:port => 4444,
|
69
62
|
:browser => "*firefox",
|
70
63
|
:url => "http://www.google.com",
|
71
64
|
:timeout_in_second => 60
|
@@ -99,8 +92,6 @@ Writing Tests
|
|
99
92
|
|
100
93
|
def setup
|
101
94
|
@browser = Selenium::Client::Driver.new \
|
102
|
-
:host => "localhost",
|
103
|
-
:port => 4444,
|
104
95
|
:browser => "*firefox",
|
105
96
|
:url => "http://www.google.com",
|
106
97
|
:timeout_in_second => 60
|
@@ -139,15 +130,13 @@ Writing Tests
|
|
139
130
|
|
140
131
|
before(:all) do
|
141
132
|
@selenium_driver = Selenium::Client::Driver.new \
|
142
|
-
:host => "localhost",
|
143
|
-
:port => 4444,
|
144
133
|
:browser => "*firefox",
|
145
134
|
:url => "http://www.google.com",
|
146
135
|
:timeout_in_second => 60
|
147
136
|
end
|
148
137
|
|
149
138
|
before(:each) do
|
150
|
-
selenium_driver.start_new_browser_session
|
139
|
+
@selenium_driver.start_new_browser_session
|
151
140
|
end
|
152
141
|
|
153
142
|
# The system capture need to happen BEFORE closing the Selenium session
|
@@ -180,31 +169,11 @@ Start/Stop a Selenium Remote Control Server
|
|
180
169
|
|
181
170
|
You typically "freeze" the Selenium Remote Control jar in your `vendor`
|
182
171
|
directory.
|
183
|
-
|
184
|
-
require 'selenium/rake/tasks'
|
185
|
-
|
186
|
-
Selenium::Rake::RemoteControlStartTask.new do |rc|
|
187
|
-
rc.port = 4444
|
188
|
-
rc.timeout_in_seconds = 3 * 60
|
189
|
-
rc.background = true
|
190
|
-
rc.wait_until_up_and_running = true
|
191
|
-
rc.jar_file = "/path/to/where/selenium-rc-standalone-jar-is-installed"
|
192
|
-
rc.additional_args << "-singleWindow"
|
193
|
-
end
|
194
|
-
|
195
|
-
Selenium::Rake::RemoteControlStopTask.new do |rc|
|
196
|
-
rc.host = "localhost"
|
197
|
-
rc.port = 4444
|
198
|
-
rc.timeout_in_seconds = 3 * 60
|
199
|
-
end
|
200
172
|
|
201
173
|
If you do not explicitly specify the path to selenium remote control jar
|
202
174
|
it will be "auto-discovered" in `vendor` directory using the following
|
203
175
|
path : `vendor/selenium-remote-control/selenium-server*-standalone.jar`
|
204
176
|
|
205
|
-
Check out [RemoteControlStartTask](http://seleni-selenese.rubyforge.org/classes/Selenium/Rake/RemoteControlStartTask.html) and [RemoteControlStopTask](http://seleni-selenese.rubyforge.org/classes/Selenium/Rake/RemoteControlStopTask.html) for more
|
206
|
-
details.
|
207
|
-
|
208
177
|
State-of-the-Art RSpec Reporting
|
209
178
|
================================
|
210
179
|
|
@@ -213,7 +182,7 @@ screenshots (not limited to current viewport), and a capture of the latest remot
|
|
213
182
|
course all this works even if your infrastructure is distributed (In particular in makes wonders with [Selenium
|
214
183
|
Grid](http://selenium-grid.openqa.org))
|
215
184
|
|
216
|
-
Using selenium-
|
185
|
+
Using selenium-selenese RSpec reporting is as simple as using `SeleniumTestReportFormatter` as one of you RSpec formatters. For instance:
|
217
186
|
|
218
187
|
require 'spec/rake/spectask'
|
219
188
|
desc 'Run acceptance tests for web application'
|
@@ -234,75 +203,5 @@ Grid](http://selenium-grid.openqa.org))
|
|
234
203
|
|
235
204
|
require "rubygems"
|
236
205
|
require "spec"
|
237
|
-
require "selenium/
|
206
|
+
require "selenium/selenese"
|
238
207
|
require "selenium/rspec/spec_helper"
|
239
|
-
|
240
|
-
Other Resources
|
241
|
-
===============
|
242
|
-
|
243
|
-
* Report bugs at http://github.com/ph7/selenium-client/issues
|
244
|
-
* Browse API at http://seleni-selenese.rubyforge.org
|
245
|
-
|
246
|
-
|
247
|
-
Contribute and Join the Fun!
|
248
|
-
============================
|
249
|
-
|
250
|
-
We welcome new features, add-ons, bug fixes, example, documentation,
|
251
|
-
etc. Make the gem work the way you envision!
|
252
|
-
|
253
|
-
* Report bugs at http://github.com/ph7/selenium-client/issues
|
254
|
-
|
255
|
-
* I recommend cloning the selenium-client
|
256
|
-
[reference repository](http://github.com/ph7/selenium-client/tree/master)
|
257
|
-
|
258
|
-
* You can also check out the [RubyForge page](http://rubyforge.org/projects/selenium-client)
|
259
|
-
and the [RDoc](http://seleni-selenese.rubyforge.org)
|
260
|
-
|
261
|
-
* We also have a [continuous integration server](http://xserve.openqa.org:8080/view/Ruby%20Client)
|
262
|
-
|
263
|
-
* Stories live in [Pivotal Tracker](https://www.pivotaltracker.com/projects/6280)
|
264
|
-
* To build, run `rake clean default package`. You can then install the
|
265
|
-
generated gem with `sudo gem install pkg/*.gem`
|
266
|
-
* You can also run all integration tests with `rake ci:integration`
|
267
|
-
|
268
|
-
|
269
|
-
Core Team
|
270
|
-
=========
|
271
|
-
|
272
|
-
* Philippe Hanrigou (`ph7`): Current Maintainer and main contributor
|
273
|
-
* Aslak Hellesoy and Darren Hobbs : Original version of the Selenium Ruby driver
|
274
|
-
|
275
|
-
Contributors
|
276
|
-
============
|
277
|
-
|
278
|
-
* Aaron Tinio (`aptinio`):
|
279
|
-
- More robust Selenium RC shutdown
|
280
|
-
- Support for locator including single quotes in `wait_for_...` methods
|
281
|
-
- Do not capture system state on execution errors for pending examples
|
282
|
-
(ExamplePendingError, NotYetImplementedError)
|
283
|
-
- Auto-highlighting support
|
284
|
-
|
285
|
-
* Rick Lee-Morlang (`rleemorlang`):
|
286
|
-
- Fix for incremental calls to `wait_for_text`
|
287
|
-
- Regex support in `wait_for_text`
|
288
|
-
|
289
|
-
* [Paul Boone](http://www.mindbucket.com) (`paulboone`)
|
290
|
-
- Fixed method_missing in selenium_helper to only delegate to methods
|
291
|
-
that @selenium responds to
|
292
|
-
|
293
|
-
* [Adam Greene](http://blog.sweetspot.dm) (`skippy`)
|
294
|
-
- Added the ability to redirect output to a log file, when
|
295
|
-
launching Selenium Remote Control with the Rake task
|
296
|
-
|
297
|
-
* [Eliot Sykes](http://blog.eliotsykes.com) (`eliotsykes`)
|
298
|
-
- wait_for_visibility [patch](http://github.com/eliotsykes/selenium-client/commit/4c7f3d01aa75a6b1917fbf71335b0069392ed546)
|
299
|
-
|
300
|
-
* [Frederik Fix](http://github.com/derfred)(`derfred`)
|
301
|
-
- Fix escaping bug when dealing with embedded regexes such as
|
302
|
-
"webratlink=evalregex:/Pastry Lovers \\(Organizer\\)/"
|
303
|
-
[patch](http://github.com/derfred/selenium-client/commit/4342cbb39d1a92b8db8f26ee0dc6c1a8f3287737)
|
304
|
-
|
305
|
-
* [Alex Chaffe](http://alexch.github.com)
|
306
|
-
- Better error reporting and fixed bug where if the response
|
307
|
-
doesn't start with "OK" it swallows the first three
|
308
|
-
chars (leading to annoying "ed out after 5000 msec" messages)
|
@@ -121,7 +121,7 @@ module Selenium
|
|
121
121
|
selenese_commands << "<tr><td>#{command[0]}</td><td>#{command[1]}</td><td>#{command[2]}</td></tr>"
|
122
122
|
end
|
123
123
|
|
124
|
-
script = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head profile="http://selenium-ide.openqa.org/profiles/test-case"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="selenium.base" href="http://www.google.co.in/" /><title>myscript<title></head><body><table cellpadding="1" cellspacing="1" border="1"><thead><tr><td rowspan="1" colspan="3">
|
124
|
+
script = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head profile="http://selenium-ide.openqa.org/profiles/test-case"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="selenium.base" href="http://www.google.co.in/" /><title>myscript<title></head><body><table cellpadding="1" cellspacing="1" border="1"><thead><tr><td rowspan="1" colspan="3">Selenese Script</td></tr></thead><tbody>'+selenese_commands+'</tbody></table></body></html>'
|
125
125
|
return script
|
126
126
|
end
|
127
127
|
|
data/lib/selenium/selenese.rb
CHANGED
@@ -22,3 +22,27 @@ require File.expand_path(File.dirname(__FILE__) + '/remote_control/remote_contro
|
|
22
22
|
require File.expand_path(File.dirname(__FILE__) + '/rake/remote_control_start_task')
|
23
23
|
require File.expand_path(File.dirname(__FILE__) + '/rake/remote_control_stop_task')
|
24
24
|
|
25
|
+
|
26
|
+
def exec_selenese_script(file)
|
27
|
+
f = File.new(file,"r")
|
28
|
+
string = ""
|
29
|
+
f.readlines.each { |line|
|
30
|
+
line.strip!
|
31
|
+
string = string + line.to_s
|
32
|
+
}
|
33
|
+
str_arr = string.partition("<tbody>")
|
34
|
+
str_arr.shift(2)
|
35
|
+
arr = str_arr[0].split("</tr>")
|
36
|
+
arr.pop
|
37
|
+
commands = []
|
38
|
+
arr.each{|ele| commands << ele.gsub("<tr><td>","").gsub("</td><td>",",").gsub("</td>","").split(",")}
|
39
|
+
@browser = Selenium::Client::Driver.new(:browser=>"*firefox", :timeout_in_second=> 15000, :url => "http://www.google.com")
|
40
|
+
@browser.start_new_browser_session
|
41
|
+
commands.each do |command|
|
42
|
+
args = []
|
43
|
+
args << command[1]
|
44
|
+
args << command[2]
|
45
|
+
@browser.remote_control_command(command[0],args)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
data/vendor/selenium-server.jar
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,33 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-selenese
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 4
|
10
|
-
version: 1.1.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.6
|
5
|
+
prerelease: !!null
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Technologies
|
14
|
-
autorequire:
|
9
|
+
autorequire: !!null
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
default_executable:
|
12
|
+
date: 2011-02-01 00:00:00.000000000 +05:30
|
13
|
+
default_executable: !!null
|
20
14
|
dependencies: []
|
21
|
-
|
22
|
-
|
15
|
+
description: The Selenium Server and Selenium client are merged into single gem. This
|
16
|
+
gem gives you the option to convert the selenium commands into selense script and
|
17
|
+
vice versa.
|
23
18
|
email: dharsininitt@gmail.com
|
24
19
|
executables: []
|
25
|
-
|
26
20
|
extensions: []
|
27
|
-
|
28
|
-
extra_rdoc_files:
|
21
|
+
extra_rdoc_files:
|
29
22
|
- README.markdown
|
30
|
-
files:
|
23
|
+
files:
|
31
24
|
- lib/nautilus/shell.rb
|
32
25
|
- lib/selenium/client/base.rb
|
33
26
|
- lib/selenium/client/driver.rb
|
@@ -59,43 +52,36 @@ files:
|
|
59
52
|
- vendor/selenium-server.jar
|
60
53
|
- README.markdown
|
61
54
|
has_rdoc: true
|
62
|
-
homepage:
|
55
|
+
homepage: ''
|
63
56
|
licenses: []
|
64
|
-
|
65
|
-
|
66
|
-
rdoc_options:
|
57
|
+
post_install_message: !!null
|
58
|
+
rdoc_options:
|
67
59
|
- --charset=UTF-8
|
68
60
|
- --title
|
69
61
|
- Selenium Selenese
|
70
62
|
- --main
|
71
63
|
- README
|
72
64
|
- --line-numbers
|
73
|
-
require_paths:
|
65
|
+
require_paths:
|
74
66
|
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
68
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
|
82
|
-
- 0
|
83
|
-
version: "0"
|
84
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
74
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
version: "0"
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
93
79
|
requirements: []
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
80
|
+
rubyforge_project: !!null
|
81
|
+
rubygems_version: 1.5.0
|
82
|
+
signing_key: !!null
|
98
83
|
specification_version: 3
|
99
|
-
summary: The Selenium Server and Selenium client are merged into single gem. This
|
84
|
+
summary: The Selenium Server and Selenium client are merged into single gem. This
|
85
|
+
gem gives you the option to convert the selenium commands into selense script and
|
86
|
+
vice versa.
|
100
87
|
test_files: []
|
101
|
-
|