selenium-dsl 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/selenium_dsl.rb CHANGED
@@ -24,7 +24,7 @@ class SeleniumDsl
24
24
  @code = {}
25
25
  @path = '~'
26
26
  @opt = []
27
- @r_eng = [/^(debug|chrome|firefox|phantomjs|remote|resize|visit|wait|quit|if|screenshot)/] #mock|debug|
27
+ @r_eng = [/^(debug|chrome|firefox|phantomjs|remote|resize|visit|wait|quit|if|screenshot|sleep)/] #mock|debug|
28
28
  @r_mcr = [/^\$[\-\w]+ *\=/,/^\$[\-\w]+[^\=]/]
29
29
  @r_cmd = [nodes, action]
30
30
  @r_mod = [/^(def +|end)/]
@@ -47,6 +47,7 @@ class SeleniumDsl
47
47
  wait.until do
48
48
  try=5
49
49
  begin
50
+ # binding.pry
50
51
  nodes = @nodes.find_elements(typ, el)[idx-1]
51
52
  rescue Exception => e
52
53
  if e.class == Selenium::WebDriver::Error::NoSuchWindowError ||
@@ -62,19 +63,24 @@ class SeleniumDsl
62
63
  end
63
64
  end
64
65
  @nodes = nodes if nodes
66
+ # puts "func : #{el} #{idx}" if opt_v
67
+ # puts "TAG : #{@nodes.tag_name}" if opt_v
68
+ # puts "TEXT: #{@nodes.text}" if opt_v
65
69
  nodes
66
70
  end
67
71
  print (opt_m ? '.' : '.'.green) if !opt_v
68
72
  rescue Exception => e
73
+ # puts "TAG : #{@nodes.tag_name}" if opt_v
74
+ # puts @nodes.text if opt_v
69
75
  failed
70
76
  end
71
77
 
72
78
  def parse_cmd(line)
73
79
  arr = match_line(@r_cmd,line.strip,'cmd')
74
80
  query,cmd,prm = arr
81
+ @nodes = @driver
75
82
  if query!=[] && !(cmd==[] && prm=='') && !@mock
76
83
  puts "#{@path}>cmd: #{arr.inspect}" if opt_v
77
- @nodes = @driver
78
84
 
79
85
  query.each do |el|
80
86
  idx = el[/\[([\w\d=]+)\]/,1].to_i
@@ -173,6 +179,7 @@ class SeleniumDsl
173
179
  if @return =~ /#{prm[2,99].strip}/
174
180
  print (opt_m ? '.' : '.'.green) if !opt_v
175
181
  else
182
+ puts "#{@return} =~ /#{prm[2,99].strip}/" if opt_t
176
183
  failed
177
184
  end
178
185
  end
@@ -65,6 +65,10 @@ class SeleniumDsl
65
65
  @mock = true
66
66
  end
67
67
 
68
+ def _sleep(prm)
69
+ sleep prm.to_i
70
+ end
71
+
68
72
  if ARGV[1]=~/\-.*[d]/
69
73
  def _debug(prm)
70
74
  binding.pry
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.7
4
+ version: 0.1.8
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-20 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project: selenium-dsl
90
- rubygems_version: 1.8.24
90
+ rubygems_version: 1.8.23
91
91
  signing_key:
92
92
  specification_version: 3
93
93
  summary: Simple DSL for Selenium