selenium-dsl 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/sd CHANGED
@@ -7,13 +7,14 @@ else
7
7
  puts <<END
8
8
  Selenium DSL
9
9
  ============
10
- > selenium-dsl <script-file> [-mqrsv] #OR
11
- > sd <script-file> [-mqrsv]
12
- --------------------------
10
+ > selenium-dsl <script-file> [-mqrstv] #OR
11
+ > sd <script-file> [-mqrstv]
12
+ -----------------------------
13
13
  m: mono --> no color
14
14
  q: quit --> close browser
15
15
  r: resize --> resize browser
16
16
  s: screenshot> error, screenshot!
17
+ t: trace --> trace call stack
17
18
  v: verbose --> parsing output
18
19
 
19
20
  Ex:
data/bin/selenium-dsl CHANGED
@@ -7,13 +7,14 @@ else
7
7
  puts <<END
8
8
  Selenium DSL
9
9
  ============
10
- > selenium-dsl <script-file> [-mqrsv] #OR
11
- > sd <script-file> [-mqrsv]
12
- --------------------------
10
+ > selenium-dsl <script-file> [-mqrstv] #OR
11
+ > sd <script-file> [-mqrstv]
12
+ -----------------------------
13
13
  m: mono --> no color
14
14
  q: quit --> close browser
15
15
  r: resize --> resize browser
16
16
  s: screenshot> error, screenshot!
17
+ t: trace --> trace call stack
17
18
  v: verbose --> parsing output
18
19
 
19
20
  Ex:
@@ -20,17 +20,13 @@ class SeleniumDsl
20
20
  wait.until do
21
21
  try=5
22
22
  begin
23
- # sleep 1
24
23
  nodes = @nodes.find_element(typ, el)
25
24
  rescue Exception => e
26
25
  if e.class == Selenium::WebDriver::Error::NoSuchWindowError ||
27
26
  e.class == Selenium::WebDriver::Error::NoSuchElementError
28
- if e.class == Selenium::WebDriver::Error::NoSuchWindowError
29
- puts "switch window from #{@driver.window_handle} to #{@driver.window_handles[0]}" if !opt_v
30
- @driver.switch_to.window @driver.window_handles[0]
31
- # binding.pry
32
- end
33
- # binding.pry
27
+ puts "switch: #{@driver.window_handle} to #{@driver.window_handles.inspect}" if opt_v
28
+ @driver.switch_to.window @driver.window_handles[0]
29
+ sleep 1
34
30
  try-= 1
35
31
  try>0 ? retry : raise(e.class,e.to_s)
36
32
  else
@@ -51,16 +47,13 @@ class SeleniumDsl
51
47
  wait.until do
52
48
  try=5
53
49
  begin
54
- # sleep 1
55
50
  nodes = @nodes.find_elements(typ, el)[idx-1]
56
51
  rescue Exception => e
57
52
  if e.class == Selenium::WebDriver::Error::NoSuchWindowError ||
58
53
  e.class == Selenium::WebDriver::Error::NoSuchElementError
59
- if e.class == Selenium::WebDriver::Error::NoSuchWindowError
60
- puts "switch window from #{@driver.window_handle} to #{@driver.window_handles[0]}" if !opt_v
61
- @driver.switch_to.window @driver.window_handles[0]
62
- # binding.pry
63
- end
54
+ puts "switch: #{@driver.window_handle} to #{@driver.window_handles.inspect}" if opt_v
55
+ @driver.switch_to.window @driver.window_handles[0]
56
+ sleep 1
64
57
  try-= 1
65
58
  try>0 ? retry : raise(e.class,e.to_s)
66
59
  else
data/lib/selenium_dsl.rb CHANGED
@@ -90,6 +90,10 @@ class SeleniumDsl
90
90
  (opt=@opt.select{|x|x=~/\-\w*[s]/})==[] ? nil : opt[0]
91
91
  end
92
92
 
93
+ def opt_t
94
+ (opt=@opt.select{|x|x=~/\-\w*[t]/})==[] ? nil : opt[0]
95
+ end
96
+
93
97
  def opt_v
94
98
  (opt=@opt.select{|x|x=~/\-\w*[v]/})==[] ? nil : opt[0]
95
99
  end
@@ -151,7 +155,7 @@ class SeleniumDsl
151
155
  end
152
156
  end
153
157
  @driver.quit if opt_q && @driver
154
- # puts caller
158
+ puts caller if opt_t
155
159
  Kernel.exit(1)
156
160
  end
157
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
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: 2012-12-19 00:00:00.000000000 Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver