selenium-dsl 0.1.1 → 0.1.2

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.
@@ -75,23 +75,29 @@ class SeleniumDsl
75
75
 
76
76
  def parse_cmd(line)
77
77
  arr = match_line(@r_cmd,line.strip,'cmd')
78
-
79
78
  query,cmd,prm = arr
80
79
  if query!=[] && !(cmd==[] && prm=='') && !@mock
81
80
  puts "#{@path}>cmd: #{arr.inspect}" if opt_v
82
81
  @nodes = @driver
83
82
 
84
83
  query.each do |el|
84
+ idx = el[/\[([\w\d=]+)\]/,1].to_i
85
+ el.sub!(/\[(\d+)\]/,'') if idx>0
85
86
  if el[0]==":"
86
- find_element(:name, el[1,99])
87
+ if idx>0
88
+ find_elements(:name, el[1,99],idx)
89
+ else
90
+ find_element(:name, el[1,99])
91
+ end
87
92
  elsif el[0]=="/"
88
- find_element(:xpath,"/#{el}")
93
+ if idx>0
94
+ find_elements(:xpath, "/#{el}",idx)
95
+ else
96
+ find_element(:xpath, "/#{el}")
97
+ end
89
98
  else
90
- idx = el[/\[(\d+)\]/,1].to_i
91
- el.sub!(/\[(\d+)\]/,'')
92
99
  if el[0]==">"
93
100
  if idx>0
94
- # binding.pry
95
101
  find_elements(:css, el[1,99],idx)
96
102
  else
97
103
  find_element(:css, el[1,99])
@@ -150,6 +156,7 @@ class SeleniumDsl
150
156
  end
151
157
  end
152
158
  rescue Exception => e
159
+ puts "~>err: #{e.to_s}"
153
160
  failed
154
161
  end
155
162
 
@@ -26,6 +26,7 @@ class SeleniumDsl
26
26
  # the first array, so it need to split for prm
27
27
  def parse_fnc(line)
28
28
  arr = match_line(@r_fnc,line.strip,'mod')
29
+ return false if arr[0]==[] #[/^ *\w+.*/] - :code=123 - [[], ":code=123"]
29
30
  cmd,prm = arr[0][0].split(/ +/,2)
30
31
  npath = "#{@path}/#{cmd}"
31
32
  if @code.keys.index("~/#{cmd}")
data/lib/selenium_dsl.rb CHANGED
@@ -15,7 +15,7 @@ class SeleniumDsl
15
15
  include Modules
16
16
 
17
17
  def init
18
- nodes = /^(\>*([\-\w]*(\.[.\[\]\-\d\w]+|[#:][\-\d\w]+)|[\d\w]+)|\/\w+)(\[\d+\])*/
18
+ nodes = /^(\>*([\-\w]*(\.[.\[\]\-\d\w]+|[#:][\-\d\w]+)|\w+(\[\w+\=[\d\w"]+\])*)|\/[\w@"=\[\]]+)(\[\d+\])*/
19
19
  action = /^[~]\w+(\:\w+)*/
20
20
  @driver = nil
21
21
  @nodes = nil
@@ -120,6 +120,7 @@ class SeleniumDsl
120
120
  puts "#{no+1}. #{tx}"
121
121
  end
122
122
  puts "#{l+1}. #{r[l]}" if r[l]
123
+ puts caller
123
124
  Kernel.exit(1)
124
125
  end
125
126
  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.1
4
+ version: 0.1.2
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-10 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver