selenium-selenese 1.1.10 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/selenium/client/base.rb +24 -0
- data/lib/selenium/selenese.rb +0 -25
- metadata +1 -1
data/lib/selenium/client/base.rb
CHANGED
@@ -137,4 +137,28 @@ module Selenium
|
|
137
137
|
end
|
138
138
|
|
139
139
|
end
|
140
|
+
|
141
|
+
def exec_selenese_script(file)
|
142
|
+
f = File.new(file,"r")
|
143
|
+
string = ""
|
144
|
+
f.readlines.each { |line|
|
145
|
+
line.strip!
|
146
|
+
string = string + line.to_s
|
147
|
+
}
|
148
|
+
str_arr = string.partition("<tbody>")
|
149
|
+
str_arr.shift(2)
|
150
|
+
arr = str_arr[0].split("</tr>")
|
151
|
+
arr.pop
|
152
|
+
commands = []
|
153
|
+
arr.each{|ele| commands << ele.gsub("<tr><td>","").gsub("</td><td>",",").gsub("</td>","").split(",")}
|
154
|
+
@browser = Selenium::Client::Driver.new(:browser=>"*firefox", :timeout_in_second=> 15000, :url => "http://www.google.com")
|
155
|
+
@browser.start_new_browser_session
|
156
|
+
commands.each do |command|
|
157
|
+
args = []
|
158
|
+
args << command[1]
|
159
|
+
args << command[2]
|
160
|
+
@browser.remote_control_command(command[0],args)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
140
164
|
end
|
data/lib/selenium/selenese.rb
CHANGED
@@ -22,28 +22,3 @@ 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
|
-
public
|
26
|
-
|
27
|
-
def exec_selenese_script(file)
|
28
|
-
f = File.new(file,"r")
|
29
|
-
string = ""
|
30
|
-
f.readlines.each { |line|
|
31
|
-
line.strip!
|
32
|
-
string = string + line.to_s
|
33
|
-
}
|
34
|
-
str_arr = string.partition("<tbody>")
|
35
|
-
str_arr.shift(2)
|
36
|
-
arr = str_arr[0].split("</tr>")
|
37
|
-
arr.pop
|
38
|
-
commands = []
|
39
|
-
arr.each{|ele| commands << ele.gsub("<tr><td>","").gsub("</td><td>",",").gsub("</td>","").split(",")}
|
40
|
-
@browser = Selenium::Client::Driver.new(:browser=>"*firefox", :timeout_in_second=> 15000, :url => "http://www.google.com")
|
41
|
-
@browser.start_new_browser_session
|
42
|
-
commands.each do |command|
|
43
|
-
args = []
|
44
|
-
args << command[1]
|
45
|
-
args << command[2]
|
46
|
-
@browser.remote_control_command(command[0],args)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|