tellurium_driver 1.1.12 → 1.1.14
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/lib/tellurium_driver.rb +26 -11
- metadata +2 -2
data/lib/tellurium_driver.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
#Provides added functionality to Selenium WebDriver
|
2
2
|
class TelluriumDriver
|
3
3
|
#takes browser name, browser version, hub ip(optional)
|
4
|
+
def self.before(names)
|
5
|
+
names.each do |name|
|
6
|
+
m = instance_method(name)
|
7
|
+
define_method(name) do |*args, &block|
|
8
|
+
yield
|
9
|
+
m.bind(self).(*args, &block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
def initialize(*args)
|
5
15
|
|
6
16
|
browser, version,hub_ip,timeout = args
|
@@ -35,22 +45,25 @@ class TelluriumDriver
|
|
35
45
|
elsif is_firefox
|
36
46
|
@driver = Selenium::WebDriver.for(:remote,:desired_capabilities=>:firefox,:url=> "http://#{hub_ip}:4444/wd/hub")
|
37
47
|
end
|
38
|
-
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
TelluriumDriver.before(TelluriumDriver.instance_methods.reject { |name| name.to_s.include?("initialize")}) do
|
53
|
+
begin
|
54
|
+
wait = Selenium::WebDriver::Wait.new(:timeout=>120)
|
55
|
+
wait.until{ self.driver.execute_script("document.readyState") == "complete" }
|
56
|
+
rescue Exception => e
|
57
|
+
puts e.message
|
58
|
+
end
|
59
|
+
|
39
60
|
end
|
61
|
+
|
40
62
|
|
41
63
|
def driver
|
42
64
|
@driver
|
43
65
|
end
|
44
66
|
|
45
|
-
def self.before(*names)
|
46
|
-
names.each do |name|
|
47
|
-
m = instance_method(name)
|
48
|
-
define_method(name) do |*args, &block|
|
49
|
-
yield
|
50
|
-
m.bind(self).(*args, &block)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
67
|
|
55
68
|
def method_missing(sym, *args, &block)
|
56
69
|
@driver.send sym,*args,&block
|
@@ -276,6 +289,8 @@ class TelluriumDriver
|
|
276
289
|
driver.quit
|
277
290
|
end
|
278
291
|
|
279
|
-
|
292
|
+
def document_ready
|
293
|
+
|
294
|
+
end
|
280
295
|
|
281
296
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tellurium_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Provides useful extra methods for Selenium WebDriver, especially helpful
|
15
15
|
in javascript webapps
|