awetestlib 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +22 -0
- data/.gitignore +69 -0
- data/AwetestLib Instructions.rtf +0 -0
- data/awetestlib.gemspec +57 -0
- data/awetestlib.windows.gemspec +41 -0
- data/awetestlib_notes.txt +4 -0
- data/awetestlib_osx.gemspec +43 -0
- data/bin/awetestlib +67 -0
- data/ext/Rakefile +1 -0
- data/ext/mkrf_conf.rb +27 -0
- data/lib/awetestlib.rb +39 -0
- data/lib/patches/README +2 -0
- data/lib/patches/firewatir.rb +106 -0
- data/lib/patches/watir.rb +175 -0
- data/lib/regression/browser.rb +1259 -0
- data/lib/regression/drag_and_drop.rb +374 -0
- data/lib/regression/find.rb +426 -0
- data/lib/regression/legacy.rb +40 -0
- data/lib/regression/logging.rb +444 -0
- data/lib/regression/page_data.rb +185 -0
- data/lib/regression/runner.rb +278 -0
- data/lib/regression/tables.rb +486 -0
- data/lib/regression/user_input.rb +1255 -0
- data/lib/regression/utilities.rb +891 -0
- data/lib/regression/validations.rb +1179 -0
- data/lib/regression/waits.rb +387 -0
- data/lib/version.rb +4 -0
- data/rdoc_test.bat +1 -0
- data/test/create_zoho.rb +65 -0
- data/test/create_zoho_account1.rb +66 -0
- data/test/create_zoho_account2.rb +71 -0
- data/test/demo.rb +86 -0
- data/test/google_search1.rb +16 -0
- data/test/google_search2.rb +19 -0
- data/test/zoho_util.rb +485 -0
- data/test/zoho_variables.xls +0 -0
- metadata +237 -0
data/.gitattributes
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
2
|
+
* text=auto
|
3
|
+
|
4
|
+
# Custom for Visual Studio
|
5
|
+
*.cs diff=csharp
|
6
|
+
*.sln merge=union
|
7
|
+
*.csproj merge=union
|
8
|
+
*.vbproj merge=union
|
9
|
+
*.fsproj merge=union
|
10
|
+
*.dbproj merge=union
|
11
|
+
|
12
|
+
# Standard to msysgit
|
13
|
+
*.doc diff=astextplain
|
14
|
+
*.DOC diff=astextplain
|
15
|
+
*.docx diff=astextplain
|
16
|
+
*.DOCX diff=astextplain
|
17
|
+
*.dot diff=astextplain
|
18
|
+
*.DOT diff=astextplain
|
19
|
+
*.pdf diff=astextplain
|
20
|
+
*.PDF diff=astextplain
|
21
|
+
*.rtf diff=astextplain
|
22
|
+
*.RTF diff=astextplain
|
data/.gitignore
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
awetestlib*.gem
|
2
|
+
*.csv
|
3
|
+
|
4
|
+
# gVim tmp files
|
5
|
+
*~
|
6
|
+
# rcov generated
|
7
|
+
coverage
|
8
|
+
|
9
|
+
# rdoc generated
|
10
|
+
rdoc
|
11
|
+
|
12
|
+
# yard generated
|
13
|
+
doc
|
14
|
+
.yardoc
|
15
|
+
|
16
|
+
# bundler
|
17
|
+
.bundle
|
18
|
+
Gemfile.lock
|
19
|
+
|
20
|
+
# jeweler generated
|
21
|
+
pkg
|
22
|
+
|
23
|
+
# for windows
|
24
|
+
Thumb.db
|
25
|
+
|
26
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
27
|
+
#
|
28
|
+
# * Create a file at ~/.gitignore
|
29
|
+
# * Include files you want ignored
|
30
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
31
|
+
#
|
32
|
+
# After doing this, these files will be ignored in all your git projects,
|
33
|
+
# saving you from having to 'pollute' every project you touch with them
|
34
|
+
#
|
35
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
36
|
+
#
|
37
|
+
# For MacOS:
|
38
|
+
#
|
39
|
+
.DS_Store
|
40
|
+
tmp/*
|
41
|
+
.rvmrc
|
42
|
+
|
43
|
+
# For TextMate
|
44
|
+
#*.tmproj
|
45
|
+
#tmtags
|
46
|
+
|
47
|
+
# For emacs:
|
48
|
+
#*~
|
49
|
+
#\#*
|
50
|
+
#.\#*
|
51
|
+
|
52
|
+
# For vim:
|
53
|
+
*.sw[onp]
|
54
|
+
|
55
|
+
# For redcar:
|
56
|
+
#.redcar
|
57
|
+
|
58
|
+
# For rubinius:
|
59
|
+
#*.rbc
|
60
|
+
|
61
|
+
config/win2008.txt
|
62
|
+
|
63
|
+
__MACOSX/
|
64
|
+
short_passing_test/
|
65
|
+
dump.rdb
|
66
|
+
.idea
|
67
|
+
config/settings.yml
|
68
|
+
PROJECT_NAME
|
69
|
+
*.log
|
Binary file
|
data/awetestlib.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
puts "#{$0}"
|
3
|
+
require "lib/version"
|
4
|
+
|
5
|
+
#hack for debugging
|
6
|
+
`wellsproxy`
|
7
|
+
#end hack
|
8
|
+
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
|
11
|
+
s.name = "awetestlib"
|
12
|
+
s.version = Awetestlib::VERSION
|
13
|
+
s.date = Awetestlib::VERSION_DATE
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
|
16
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
17
|
+
s.authors = ["Anthony Woo", "Patrick Neve"]
|
18
|
+
s.email = %q{patrick@3qilabs.com}
|
19
|
+
s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
|
20
|
+
s.homepage = %q{http://3qilabs.com}
|
21
|
+
s.description = %q{Awetest DSL for automated testing of browser-based applications.}
|
22
|
+
|
23
|
+
# possible dependencies (from shamisen gemfile)
|
24
|
+
#s.add_dependency('i18n')
|
25
|
+
|
26
|
+
# windows specific
|
27
|
+
#s.add_dependency('watir', '1.8.1')
|
28
|
+
#s.add_dependency('commonwatir', '1.8.1')
|
29
|
+
#s.add_dependency('firewatir', '1.8.1')
|
30
|
+
#s.add_dependency('watirloo')
|
31
|
+
#s.add_dependency('win32-process')
|
32
|
+
#s.add_dependency('win32screenshot')
|
33
|
+
|
34
|
+
# all platforms?
|
35
|
+
begin
|
36
|
+
#s.add_dependency('ffi', '= 1.0.9')
|
37
|
+
s.add_dependency('activesupport', '~> 3.0.0')
|
38
|
+
s.add_dependency('watir-webdriver')
|
39
|
+
s.add_dependency('andand')
|
40
|
+
s.add_dependency('spreadsheet', '0.6.8')
|
41
|
+
s.add_dependency('google-spreadsheet-ruby', '0.1.6')
|
42
|
+
s.add_dependency('roo', '1.10.1')
|
43
|
+
#s.add_dependency('selenium-client') # for running selenium scripts
|
44
|
+
s.add_dependency('selenium-webdriver')
|
45
|
+
rescue
|
46
|
+
puts "#{$!}"
|
47
|
+
end
|
48
|
+
|
49
|
+
s.require_paths = ["lib","ext"]
|
50
|
+
s.files = `git ls-files`.split("\n")
|
51
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
52
|
+
|
53
|
+
#This line tells rubygems to look for an extension to install
|
54
|
+
s.extensions << 'ext/mkrf_conf.rb'
|
55
|
+
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require "lib/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
|
6
|
+
s.name = %q{awetestlib}
|
7
|
+
s.version = Awetestlib::VERSION
|
8
|
+
s.date = Awetestlib::VERSION_DATE
|
9
|
+
s.platform = Gem::Platform::CURRENT
|
10
|
+
|
11
|
+
#s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Anthony Woo", "Patrick Neve"]
|
13
|
+
s.email = %q{patrick@3qilabs.com}
|
14
|
+
s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
|
15
|
+
s.homepage = %q{http://3qilabs.com}
|
16
|
+
s.description = %q{Awetest DSL for automated testing of browser-based applications.}
|
17
|
+
|
18
|
+
s.add_dependency('watir-webdriver')
|
19
|
+
s.add_dependency('watir', '1.8.1')
|
20
|
+
s.add_dependency('commonwatir', '1.8.1')
|
21
|
+
s.add_dependency('firewatir', '1.8.1')
|
22
|
+
s.add_dependency('activesupport', '~> 3.0.0')
|
23
|
+
s.add_dependency('i18n')
|
24
|
+
s.add_dependency('andand')
|
25
|
+
s.add_dependency('watirloo')
|
26
|
+
s.add_dependency('win32-process')
|
27
|
+
s.add_dependency('win32screenshot')
|
28
|
+
s.add_dependency('spreadsheet', '0.6.8')
|
29
|
+
s.add_dependency('google-spreadsheet-ruby', '0.1.6')
|
30
|
+
s.add_dependency('roo', '1.10.1')
|
31
|
+
s.add_dependency('selenium-webdriver')
|
32
|
+
s.add_dependency('pry')
|
33
|
+
s.add_dependency('rdoc', '~> 3.11')
|
34
|
+
|
35
|
+
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.files = `git ls-files`.split("\n")
|
38
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require "lib/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
|
6
|
+
s.name = %q{awetestlib}
|
7
|
+
s.version = Awetestlib::VERSION
|
8
|
+
s.date = Awetestlib::VERSION_DATE
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Anthony Woo", "Patrick Neve"]
|
13
|
+
s.email = %q{patrick@3qilabs.com}
|
14
|
+
s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
|
15
|
+
s.homepage = %q{http://3qilabs.com}
|
16
|
+
s.description = %q{Awetest DSL for automated testing of browser-based applications.}
|
17
|
+
|
18
|
+
s.add_dependency('watir-webdriver')
|
19
|
+
#s.add_dependency('watir', '1.8.1')
|
20
|
+
#s.add_dependency('commonwatir', '1.8.1')
|
21
|
+
#s.add_dependency('firewatir', '1.8.1')
|
22
|
+
s.add_dependency('activesupport', '~> 3.0.0')
|
23
|
+
s.add_dependency('andand')
|
24
|
+
#s.add_dependency('watirloo')
|
25
|
+
#s.add_dependency('win32-process')
|
26
|
+
#s.add_dependency('win32screenshot')
|
27
|
+
s.add_dependency('spreadsheet', '0.6.8')
|
28
|
+
s.add_dependency('google-spreadsheet-ruby', '0.1.6')
|
29
|
+
s.add_dependency('roo', '1.10.1')
|
30
|
+
s.add_dependency('multipart-post', '1.1.4')
|
31
|
+
s.add_dependency('selenium-webdriver')
|
32
|
+
s.add_dependency('nokogiri')
|
33
|
+
|
34
|
+
|
35
|
+
s.require_paths = ["lib"] #,"ext"]
|
36
|
+
s.files = `git ls-files`.split("\n")
|
37
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
38
|
+
|
39
|
+
#This line tells rubygems to look for an extension to install
|
40
|
+
#s.extensions = ["ext\\mkrf_conf.rb"]
|
41
|
+
|
42
|
+
end
|
43
|
+
|
data/bin/awetestlib
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
$: << "./lib"
|
2
|
+
require 'optparse'
|
3
|
+
require 'awetestlib'
|
4
|
+
|
5
|
+
options = { }
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage: awetestlib <script_file> [options]"
|
8
|
+
|
9
|
+
opts.on("-m RUN_MODE", "--run_mode RUN_MODE", "Specify the run mode: local, local_zip, remote_zip") do |run_mode|
|
10
|
+
options[:run_mode] = run_mode
|
11
|
+
end
|
12
|
+
opts.on("-r ROOT_PATH", "--root_path ROOT_PATH", "Specify the root path") do |root_path|
|
13
|
+
options[:root_path] = root_path
|
14
|
+
end
|
15
|
+
opts.on("-l LIBRARY", "--library LIBRARY", "Specify a library to be loaded") do |library|
|
16
|
+
options[:library] = library.to_s
|
17
|
+
end
|
18
|
+
opts.on("-x EXCEL_FILE", "--excel EXCEL_FILE", "Specify an excel file containing variables to be loaded") do |xls_path|
|
19
|
+
options[:xls_path] = xls_path
|
20
|
+
end
|
21
|
+
opts.on("-b BROWSER", "--browser BROWSER", "Specify a browser (IE, FF, S, C)") do |browser|
|
22
|
+
options[:browser] = browser
|
23
|
+
end
|
24
|
+
opts.on("-v VERSION", "--version VERSION", "Specify a browser version") do |v|
|
25
|
+
options[:version] = v
|
26
|
+
end
|
27
|
+
opts.on("-e", "--environment_url ENVIRONMENT_URL", "Specify the environment URL") do |environment_url|
|
28
|
+
options[:environment_url] = environment_url
|
29
|
+
end
|
30
|
+
opts.on("-f", "--environment_node_name ENVIRONMENT_NODENAME", "Specify the environment node name") do |node_name|
|
31
|
+
options[:environment_nodename] = node_name
|
32
|
+
end
|
33
|
+
opts.on("-n", "--environment_name ENVIRONMENT_NAME", "Specify the environment name") do |environment_name|
|
34
|
+
options[:environment_name] = environment_name
|
35
|
+
end
|
36
|
+
opts.on("-u SELENIUM_REMOTE_URL", "--selenium_remote_url SELENIUM_REMOTE_URL", "Specify the device's remote url and port") do |remote_url|
|
37
|
+
options[:remote_url] = remote_url
|
38
|
+
end
|
39
|
+
opts.on("-s SCREENCAP_PATH", "--screencap-path SCREENCAP_PATH", "Specify the path where screenshots will be saved") do |screencap_path|
|
40
|
+
options[:screencap_path] = screencap_path
|
41
|
+
end
|
42
|
+
opts.on("-d", "--debug", "Run debugger on first script failure") do
|
43
|
+
options[:debug_on_fail] = true
|
44
|
+
end
|
45
|
+
# add persistent logging for awetestlib. pmn 05jun2012
|
46
|
+
opts.on("-o", "--output_to_log", "Write to log file") do
|
47
|
+
options[:output_to_log] = true
|
48
|
+
end
|
49
|
+
opts.on("", "--log_path_subdir LOG_PATH_SUBDIR", "Specify log path relative to root_path.") do |log_path_subdir|
|
50
|
+
options[:log_path_subdir] = log_path_subdir
|
51
|
+
end
|
52
|
+
opts.on("", "--report_all_test_refs REPORT_ALL_TEST_REFS", "Include list of all error/test case reference ids actually validated.") do
|
53
|
+
options[:report_all_test_refs] = true
|
54
|
+
end
|
55
|
+
|
56
|
+
end.parse!
|
57
|
+
|
58
|
+
options[:environment] ||= {}
|
59
|
+
options[:environment]["name"] = options[:environment_name]
|
60
|
+
options[:environment]["url"] = options[:environment_url]
|
61
|
+
options[:environment]["nodename"] = options[:environment_nodename]
|
62
|
+
options[:script_type] = 'AwetestLegacy'
|
63
|
+
options[:script_file] = ARGV[0]
|
64
|
+
|
65
|
+
IS_WIN_2008 = File.exists?("config/win2008.txt")
|
66
|
+
|
67
|
+
Awetestlib::Runner.new(options).start
|
data/ext/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
task :default
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems/dependency_installer.rb'
|
2
|
+
using_windows = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
3
|
+
#using_jruby = defined?(JRUBY_VERSION)
|
4
|
+
using_osx = RUBY_PLATFORM =~ /darwin/
|
5
|
+
installer = Gem::DependencyInstaller.new
|
6
|
+
begin
|
7
|
+
puts "#{RUBY_PLATFORM}"
|
8
|
+
if using_windows
|
9
|
+
installer.install "watirloo", ">=0"
|
10
|
+
installer.install "win32-process", ">=0"
|
11
|
+
installer.install "win32-screenshot", ">=0"
|
12
|
+
installer.install "commonwatir", "=1.8.1"
|
13
|
+
installer.install "watir", "=1.8.1"
|
14
|
+
installer.install "firewatir", "=1.8.1"
|
15
|
+
elsif using_osx
|
16
|
+
installer.install "rb_appscript", ">=0"
|
17
|
+
installer.install "safariwatir", ">=0"
|
18
|
+
end
|
19
|
+
|
20
|
+
rescue
|
21
|
+
puts "#{$!}"
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
|
26
|
+
f.write("task :default\n")
|
27
|
+
f.close
|
data/lib/awetestlib.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'active_support/core_ext/hash'
|
3
|
+
|
4
|
+
module Awetestlib
|
5
|
+
::USING_WINDOWS = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
6
|
+
::USING_OSX = RUBY_PLATFORM =~ /darwin/
|
7
|
+
|
8
|
+
BROWSER_MAP = {
|
9
|
+
'FF' => 'Firefox',
|
10
|
+
'IE' => 'Internet Explorer',
|
11
|
+
'S' => 'Safari',
|
12
|
+
'MS' => 'Mobile Safari',
|
13
|
+
'C' => 'Chrome'
|
14
|
+
}
|
15
|
+
|
16
|
+
BROWSER_ALTERNATES = {
|
17
|
+
'OSX' => { 'IE' => 'S' },
|
18
|
+
'Windows' => { 'S' => 'IE' }
|
19
|
+
}
|
20
|
+
|
21
|
+
if USING_WINDOWS
|
22
|
+
#require 'win32ole' <-- We'll load this later in Shamisen::AwetestLegacy::Runner. It has to be loaded after watir, see https://www.pivotaltracker.com/story/show/19249981
|
23
|
+
require 'win32/screenshot'
|
24
|
+
end
|
25
|
+
#require 'active_support/inflector'
|
26
|
+
#require 'active_support/core_ext/object'
|
27
|
+
#require 'active_support/core_ext/hash'
|
28
|
+
|
29
|
+
require 'andand'
|
30
|
+
require 'regression/runner'
|
31
|
+
|
32
|
+
|
33
|
+
if USING_OSX
|
34
|
+
require 'appscript'
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'roo'
|
38
|
+
|
39
|
+
end
|
data/lib/patches/README
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
module FireWatir
|
2
|
+
class Firefox
|
3
|
+
|
4
|
+
def close
|
5
|
+
|
6
|
+
if js_eval("getWindows().length").to_i == 1
|
7
|
+
js_eval("getWindows()[0].close()")
|
8
|
+
|
9
|
+
if current_os == :macosx
|
10
|
+
%x{ osascript -e 'tell application "Firefox" to quit' }
|
11
|
+
end
|
12
|
+
|
13
|
+
# wait for the app to close properly
|
14
|
+
@t.join if @t
|
15
|
+
else
|
16
|
+
# Check if window exists, because there may be the case that it has been closed by click event on some element.
|
17
|
+
# For e.g: Close Button, Close this Window link etc.
|
18
|
+
window_number = find_window(:url, @window_url)
|
19
|
+
|
20
|
+
# If matching window found. Close the window.
|
21
|
+
if window_number.try(:>, 0)
|
22
|
+
js_eval "getWindows()[#{window_number}].close()"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
# Waits for the page to get loaded.
|
31
|
+
def wait(last_url = nil)
|
32
|
+
#puts "In wait function "
|
33
|
+
isLoadingDocument = ""
|
34
|
+
start = Time.now
|
35
|
+
|
36
|
+
while isLoadingDocument != "false"
|
37
|
+
# MONKEYPATCH - START
|
38
|
+
isLoadingDocument = js_eval("#{browser_var}=#{window_var}.getBrowser(); #{browser_var}.webProgress.isLoadingDocument;") rescue return
|
39
|
+
# MONKEYPATCH - END
|
40
|
+
#puts "Is browser still loading page: #{isLoadingDocument}"
|
41
|
+
|
42
|
+
# Raise an exception if the page fails to load
|
43
|
+
if (Time.now - start) > 300
|
44
|
+
raise "Page Load Timeout"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
# If the redirect is to a download attachment that does not reload this page, this
|
48
|
+
# method will loop forever. Therefore, we need to ensure that if this method is called
|
49
|
+
# twice with the same URL, we simply accept that we're done.
|
50
|
+
url = js_eval("#{browser_var}.contentDocument.URL")
|
51
|
+
|
52
|
+
if(url != last_url)
|
53
|
+
# Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh
|
54
|
+
# doesn't detect any javascript redirects so check it here.
|
55
|
+
# If page redirects to itself that this code will enter in infinite loop.
|
56
|
+
# So we currently don't wait for such a page.
|
57
|
+
# wait variable in JSSh tells if we should wait more for the page to get loaded
|
58
|
+
# or continue. -1 means page is not redirected. Anyother positive values means wait.
|
59
|
+
jssh_command = "var wait = -1; var meta = null; meta = #{browser_var}.contentDocument.getElementsByTagName('meta');
|
60
|
+
if(meta != null)
|
61
|
+
{
|
62
|
+
var doc_url = #{browser_var}.contentDocument.URL;
|
63
|
+
for(var i=0; i< meta.length;++i)
|
64
|
+
{
|
65
|
+
var content = meta[i].content;
|
66
|
+
var regex = new RegExp(\"^refresh$\", \"i\");
|
67
|
+
if(regex.test(meta[i].httpEquiv))
|
68
|
+
{
|
69
|
+
var arrContent = content.split(';');
|
70
|
+
var redirect_url = null;
|
71
|
+
if(arrContent.length > 0)
|
72
|
+
{
|
73
|
+
if(arrContent.length > 1)
|
74
|
+
redirect_url = arrContent[1];
|
75
|
+
|
76
|
+
if(redirect_url != null)
|
77
|
+
{
|
78
|
+
regex = new RegExp(\"^.*\" + redirect_url + \"$\");
|
79
|
+
if(!regex.test(doc_url))
|
80
|
+
{
|
81
|
+
wait = arrContent[0];
|
82
|
+
}
|
83
|
+
}
|
84
|
+
break;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
wait;"
|
90
|
+
wait_time = js_eval(jssh_command).to_i
|
91
|
+
begin
|
92
|
+
if(wait_time != -1)
|
93
|
+
sleep(wait_time)
|
94
|
+
# Call wait again. In case there are multiple redirects.
|
95
|
+
js_eval "#{browser_var} = #{window_var}.getBrowser()"
|
96
|
+
wait(url)
|
97
|
+
end
|
98
|
+
rescue
|
99
|
+
end
|
100
|
+
end
|
101
|
+
set_browser_document()
|
102
|
+
run_error_checks()
|
103
|
+
return self
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|