brand2csv 0.1.1
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/.gitignore +3 -0
- data/.rspec +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +73 -0
- data/History.txt +12 -0
- data/LICENCE.txt +515 -0
- data/LICENSE +675 -0
- data/Manifest.txt +19 -0
- data/README.md +6 -0
- data/Rakefile +23 -0
- data/lib/brand2csv.rb +341 -0
- data/lib/brand2csv/version.rb +3 -0
- data/protocol.2013.05.12.textile +56 -0
- data/protocol.2013.05.15.textile +49 -0
- data/protocol.2013.05.21.textile +24 -0
- data/resultat_1.html +697 -0
- data/spike.rb +491 -0
- data/spike_mechanize_swissreg.rb +312 -0
- data/spike_watir.rb +58 -0
- metadata +151 -0
@@ -0,0 +1,312 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'mechanize'
|
3
|
+
require 'prettyprint'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
Useage = "Usage: #{File.basename(__FILE__)} timespan
|
7
|
+
Find all brands registered in switzerland during the given timespan.
|
8
|
+
The following examples valid timespan periods:
|
9
|
+
1.10.2005
|
10
|
+
1.10.2005-31.10.2005
|
11
|
+
1.10.2005, 5.10.2005-31.10.2005
|
12
|
+
"
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.banner = Useage
|
15
|
+
opts.on("-h", "--help", "Show this help") do |v|
|
16
|
+
puts opts
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
unless ARGV
|
21
|
+
puts Useage
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
|
25
|
+
timespan = ARGV[0]
|
26
|
+
|
27
|
+
module Brand2csv do
|
28
|
+
# Weitere gesehene Fehler
|
29
|
+
bekannteFehler =
|
30
|
+
['Das Datum ist ung', # ültig'
|
31
|
+
'Es wurden keine Daten gefunden.',
|
32
|
+
'Die Suchkriterien sind teilweise unzul', # ässig',
|
33
|
+
'Geben Sie mindestens ein Suchkriterium ein',
|
34
|
+
'Die Suche wurde abgebrochen, da die maximale Suchzeit von 60 Sekunden',
|
35
|
+
]
|
36
|
+
end
|
37
|
+
$base_uri = 'https://www.swissreg.ch'
|
38
|
+
$start_uri = "#{$base_uri}/srclient/faces/jsp/start.jsp"
|
39
|
+
|
40
|
+
def writeResponse(filename, body)
|
41
|
+
ausgabe = File.open(filename, 'w+')
|
42
|
+
ausgabe.puts body
|
43
|
+
ausgabe.close
|
44
|
+
end
|
45
|
+
|
46
|
+
def view_state(response)
|
47
|
+
if match = /javax.faces.ViewState.*?value="([^"]+)"/u.match(response.force_encoding('utf-8'))
|
48
|
+
match[1]
|
49
|
+
else
|
50
|
+
""
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_swissreg(timespan = "01.06.2007-10.06.2007", # sollte 377 Treffer ergeben, für 01.06.2007-10.06.2007, 559271 wurde in diesem Zeitraum registriert
|
55
|
+
marke = nil,
|
56
|
+
nummer =nil) # nummer = "559271" ergibt genau einen treffer
|
57
|
+
|
58
|
+
a = Mechanize.new { |agent|
|
59
|
+
# agent.user_agent_alias = 'Mac Safari'
|
60
|
+
agent.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0'
|
61
|
+
# agent.redirection_limit = 5
|
62
|
+
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
63
|
+
}
|
64
|
+
|
65
|
+
page = a.get $start_uri # get a cookie for the session
|
66
|
+
content = a.get_file $start_uri
|
67
|
+
FileUtils.makedirs 'mechanize'
|
68
|
+
writeResponse('mechanize/main.html', content)
|
69
|
+
state = view_state(content)
|
70
|
+
data = [
|
71
|
+
["autoScroll", "0,0"],
|
72
|
+
["id_swissreg:_link_hidden_", ""],
|
73
|
+
["id_swissreg_SUBMIT", "1"],
|
74
|
+
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item0"],
|
75
|
+
["javax.faces.ViewState", state],
|
76
|
+
]
|
77
|
+
|
78
|
+
content = a.post($start_uri, data)
|
79
|
+
writeResponse('mechanize/einfache_suche.html', content.body)
|
80
|
+
|
81
|
+
data = [
|
82
|
+
["autoScroll", "0,0"],
|
83
|
+
["id_swissreg:_link_hidden_", ""],
|
84
|
+
["id_swissreg_SUBMIT", "1"],
|
85
|
+
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item0_item3"],
|
86
|
+
["javax.faces.ViewState", state],
|
87
|
+
]
|
88
|
+
# sr1 ist die einfache suche, sr3 die erweiterte Suche
|
89
|
+
path = "/srclient/faces/jsp/trademark/sr3.jsp"
|
90
|
+
response = a.post($base_uri + path, data)
|
91
|
+
writeResponse('mechanize/erweiterte_suche.html', response.body)
|
92
|
+
# Bis hier alles okay
|
93
|
+
criteria = [
|
94
|
+
["autoScroll", "0,0"],
|
95
|
+
["id_swissreg:_link_hidden_", ""],
|
96
|
+
# "id_swissreg:mainContent:id_cbxFormatChoice" 2 = Publikationsansicht 1 = Registeransicht
|
97
|
+
["id_swissreg:mainContent:id_cbxFormatChoice", "1"],
|
98
|
+
["id_swissreg:mainContent:id_ckbTMState", "1"], # "Hängige Gesuche 1
|
99
|
+
# ["id_swissreg:mainContent:id_ckbTMState", "2"], # "Gelöschte Gesuche 2
|
100
|
+
["id_swissreg:mainContent:id_ckbTMState", "3"], # aktive Marken 3
|
101
|
+
# ["id_swissreg:mainContent:id_ckbTMState", "4"], # gelöschte Marken 4
|
102
|
+
["id_swissreg:mainContent:id_cbxCountry", "CH"], # Auswahl Länder _ALL
|
103
|
+
# ["id_swissreg:mainContent:id_txf_tm_no", ""], # Marken Nr
|
104
|
+
["id_swissreg:mainContent:id_txf_app_no", ""], # Gesuch Nr.
|
105
|
+
["id_swissreg:mainContent:id_txf_applicant", ""], # Inhaber/in
|
106
|
+
["id_swissreg:mainContent:id_txf_agent", ""], # Vertreter/in
|
107
|
+
["id_swissreg:mainContent:id_txf_licensee", ""], # Lizenznehmer
|
108
|
+
["id_swissreg:mainContent:id_txf_nizza_class", ""], # Nizza Klassifikation Nr.
|
109
|
+
# ["id_swissreg:mainContent:id_txf_appDate", timespan], # Hinterlegungsdatum
|
110
|
+
["id_swissreg:mainContent:id_txf_expiryDate", ""], # Ablauf Schutzfrist
|
111
|
+
# Markenart: Individualmarke 1 Kollektivmarke 2 Garantiemarke 3
|
112
|
+
["id_swissreg:mainContent:id_cbxTMTypeGrp", "_ALL"], # Markenart
|
113
|
+
["id_swissreg:mainContent:id_cbxTMForm", "_ALL"], # Markentyp
|
114
|
+
["id_swissreg:mainContent:id_cbxTMColorClaim", "_ALL"], # Farbanspruch
|
115
|
+
["id_swissreg:mainContent:id_txf_pub_date", ""], # Publikationsdatum
|
116
|
+
# name="id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"], # /> Inhaber/in</label></td>
|
117
|
+
|
118
|
+
# info zu Publikationsgrund id_swissreg:mainContent:id_ckbTMPubReason
|
119
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "1"], #Neueintragungen
|
120
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "2"], #Berichtigungen
|
121
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "3"], #Verlängerungen
|
122
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "4"], #Löschungen
|
123
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "5"], #Inhaberänderungen
|
124
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "6"], #Vertreteränderungen
|
125
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "7"], #Lizenzänderungen
|
126
|
+
["id_swissreg:mainContent:id_ckbTMPubReason", "8"], #Weitere Registeränderungen
|
127
|
+
["id_swissreg:mainContent:id_ckbTMEmptyHits", "0"], # Leere Trefferliste anzeigen
|
128
|
+
|
129
|
+
# Angezeigte Spalten "id_swissreg:mainContent:id_ckbTMChoice"
|
130
|
+
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_tm_text"], # Marke
|
131
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_state"], # Status
|
132
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_nizza_class"], # Nizza Klassifikation Nr.
|
133
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_no"], # disabled="disabled"], # Nummer
|
134
|
+
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"], # Inhaber/in
|
135
|
+
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_country"], # Land (Inhaber/in)
|
136
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_agent"], # Vertreter/in
|
137
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_licensee"], # Lizenznehmer/in
|
138
|
+
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_app_date"], # Hinterlegungsdatum
|
139
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_expiry_date"], # Ablauf Schutzfrist
|
140
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_type_grp"], # Markenart
|
141
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_form"], # Markentyp
|
142
|
+
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_color_claim"], # Farbanspruch
|
143
|
+
|
144
|
+
["id_swissreg:mainContent:id_cbxHitsPerPage", "100"], # Treffer pro Seite
|
145
|
+
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"],
|
146
|
+
["id_swissreg:mainContent:sub_fieldset:id_submit", "suchen"],
|
147
|
+
# ["id_swissreg:mainContent:sub_fieldset:id_reset", "0"],
|
148
|
+
["id_swissreg_SUBMIT", "1"],
|
149
|
+
["javax.faces.ViewState", state],
|
150
|
+
]
|
151
|
+
if marke # Wortlaut der Marke
|
152
|
+
puts "Marke ist #{marke}"
|
153
|
+
criteria << ["id_swissreg:mainContent:id_txf_tm_text", marke]
|
154
|
+
else
|
155
|
+
puts "Keine Marke spezifiziert. #{marke.inspect}"
|
156
|
+
criteria << ["id_swissreg:mainContent:id_txf_tm_text", ""]
|
157
|
+
end
|
158
|
+
if timespan # Hinterlegungsdatum
|
159
|
+
puts "Hinterlegungsdatum ist #{timespan}"
|
160
|
+
criteria << ["id_swissreg:mainContent:id_txf_appDate", timespan] # Hinterlegungsdatum
|
161
|
+
else
|
162
|
+
puts "Keine Hinterlegungsdatum spezifiziert. #{timespan.inspect}"
|
163
|
+
criteria << ["id_swissreg:mainContent:id_txf_appDate", ""] # Hinterlegungsdatum
|
164
|
+
end
|
165
|
+
if nummer
|
166
|
+
puts "nummer ist #{timespan}"
|
167
|
+
criteria << ["id_swissreg:mainContent:id_txf_tm_no", nummer]
|
168
|
+
else
|
169
|
+
puts "Keine nummer spezifiziert. #{timespan.inspect}"
|
170
|
+
criteria << ["id_swissreg:mainContent:id_txf_tm_no", ""]
|
171
|
+
end
|
172
|
+
|
173
|
+
path = "/srclient/faces/jsp/trademark/sr3.jsp"
|
174
|
+
response = a.post($base_uri + path, criteria)
|
175
|
+
writeResponse('mechanize/resultate_1.html', response.body)
|
176
|
+
criteria<<['id_swissreg:mainContent:scroll_1idx2', 'idx2']
|
177
|
+
if false # does not work, returns to the extended search path
|
178
|
+
response = a.post($base_uri + path, criteria)
|
179
|
+
writeResponse('mechanize/resultate_2.html', response.body)
|
180
|
+
end
|
181
|
+
|
182
|
+
if false # Will try later
|
183
|
+
path = "/srclient/faces/jsp/trademark/sr3.jsp"
|
184
|
+
data_detail = [
|
185
|
+
["autoScroll", "0,0"],
|
186
|
+
["id_swissreg:_link_hidden_", ""],
|
187
|
+
["id_swissreg_SUBMIT", "1"],
|
188
|
+
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item0_item3"],
|
189
|
+
["javax.faces.ViewState", state],
|
190
|
+
]
|
191
|
+
|
192
|
+
response = a.post($base_uri + path, data_detail)
|
193
|
+
https://www.swissreg.ch/srclient/faces/jsp/trademark/sr30.jsp
|
194
|
+
end
|
195
|
+
end #
|
196
|
+
# parse_swissreg("01.06.2007-10.06.2007" , 'asp*')
|
197
|
+
require 'csv'
|
198
|
+
$results = []
|
199
|
+
$errors = Hash.new
|
200
|
+
|
201
|
+
class Marke < Struct.new(:name, :markennummer, :inhaber, :land, :hinterlegungsdatum, :zeile_1, :zeile_2, :zeile_3, :zeile_4, :plz, :ort)
|
202
|
+
end
|
203
|
+
|
204
|
+
AddressRegexp = /^(\d\d\d\d)\W*(.*)/
|
205
|
+
LineSplit = ', '
|
206
|
+
DefaultCountry = 'Schweiz'
|
207
|
+
|
208
|
+
def parseAddress(nummer, inhaber)
|
209
|
+
zeile_1, zeile_2, zeile_3, zeile_4, zeile_5, zeile_6 = inhaber.split(LineSplit)
|
210
|
+
ort = nil
|
211
|
+
plz = nil
|
212
|
+
if m = AddressRegexp.match(zeile_2)
|
213
|
+
zeile_2 = nil
|
214
|
+
plz = m[1]; ort = m[2]
|
215
|
+
elsif m = AddressRegexp.match(zeile_3)
|
216
|
+
zeile_3 = nil
|
217
|
+
plz = m[1]; ort = m[2]
|
218
|
+
elsif m = AddressRegexp.match(zeile_4)
|
219
|
+
zeile_4 = nil
|
220
|
+
plz = m[1]; ort = m[2]
|
221
|
+
elsif m = AddressRegexp.match(zeile_5)
|
222
|
+
zeile_5 = nil
|
223
|
+
plz = m[1]; ort = m[2]
|
224
|
+
else
|
225
|
+
puts "Achtung! Konnte Marke #{nummer} mit Inhaber #{inhaber} nicht parsen" if $VERBOSE
|
226
|
+
return nil, nil, nil, nil, nil, nil, nil, nil
|
227
|
+
end
|
228
|
+
return zeile_1, zeile_2, zeile_3, zeile_4, zeile_5, zeile_6, plz, ort
|
229
|
+
end
|
230
|
+
|
231
|
+
def fetchDetails(nummer) # takes a long time!
|
232
|
+
doc = nil
|
233
|
+
filename = "mechanize/detail_#{nummer}.html"
|
234
|
+
unless File.exists?(filename)
|
235
|
+
url = "https://www.swissreg.ch/srclient/faces/jsp/trademark/sr300.jsp?language=de§ion=tm&id=#{nummer}"
|
236
|
+
a = Mechanize.new { |agent|
|
237
|
+
# agent.user_agent_alias = 'Mac Safari'
|
238
|
+
agent.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0'
|
239
|
+
# agent.redirection_limit = 5
|
240
|
+
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
241
|
+
}
|
242
|
+
page = a.get $start_uri # get a cookie for the session
|
243
|
+
content = a.get_file url
|
244
|
+
writeResponse("mechanize/detail_#{nummer}.html", content)
|
245
|
+
end
|
246
|
+
doc = Nokogiri::Slop(File.open(filename))
|
247
|
+
path_name = "//html/body/form/div/div/fieldset/div/table/tbody/tr/td"
|
248
|
+
elem = doc.xpath(path_name).first
|
249
|
+
counter = 0
|
250
|
+
doc.xpath(path_name).each{
|
251
|
+
|td|
|
252
|
+
pp "#{counter}: #{td.text}" if $VERBOSE
|
253
|
+
counter += 1
|
254
|
+
next unless /^inhaber/i.match(td.text)
|
255
|
+
zeilen = []
|
256
|
+
doc.xpath(path_name)[counter].children.each{ |child| zeilen << child.text.gsub(LineSplit,'. ') unless child.text.length == 0 } # avoid adding <br>
|
257
|
+
if info = $errors[nummer]
|
258
|
+
info.inhaber = zeilen.join(LineSplit)
|
259
|
+
info.zeile_1, info.zeile_2, info.zeile_3, info.zeile_4, zeile_5, zeile_6, info.plz, info.ort = parseAddress(nummer, info.inhaber)
|
260
|
+
$results << info
|
261
|
+
else
|
262
|
+
bezeichnung = doc.xpath(path_name)[15]
|
263
|
+
inhaber = zeilen.join(LineSplit)
|
264
|
+
zeile_1, zeile_2, zeile_3, zeile_4, zeile_5, zeile_6, plz, ort = parseAddress(nummer, inhaber)
|
265
|
+
hinterlegungsdatum = doc.xpath(path_name)[7]
|
266
|
+
marke = Marke.new(bezeichnung, nummer, inhaber, DefaultCountry, hinterlegungsdatum, zeile_1, zeile_2, zeile_3, zeile_4, plz, ort )
|
267
|
+
$results << marke
|
268
|
+
end
|
269
|
+
}
|
270
|
+
end
|
271
|
+
|
272
|
+
def fetchresult(filename= 'mechanize/resultate_1.html')
|
273
|
+
nrFailures = 0
|
274
|
+
# doc = Nokogiri::Slop(inhalt)
|
275
|
+
doc = Nokogiri::Slop(File.open(filename))
|
276
|
+
path_name = "//html/body/form/div/div/fieldset/table/tbody/tr/td/table/tbody/tr"
|
277
|
+
elem = doc.xpath(path_name).first
|
278
|
+
doc.xpath(path_name).each{
|
279
|
+
|elem|
|
280
|
+
bezeichnung = elem.elements[1].text
|
281
|
+
land = elem.elements[4].text
|
282
|
+
next unless /#{DefaultCountry}/i.match(land)
|
283
|
+
inhaber = elem.elements[3].text
|
284
|
+
nummer = elem.elements[2].text
|
285
|
+
if bezeichnung.length == 0
|
286
|
+
bezeichnung = elem.children[1].children[0].children[0].children[0].attribute('src').to_s
|
287
|
+
end
|
288
|
+
zeile_1, zeile_2, zeile_3, zeile_4, zeile_5, zeile_6, plz, ort = parseAddress(nummer, inhaber)
|
289
|
+
if zeile_1
|
290
|
+
$results << Marke.new(bezeichnung, elem.elements[2].text, elem.elements[3].text, land, elem.elements[5].text,
|
291
|
+
zeile_1, zeile_2, zeile_3, zeile_4, plz, ort )
|
292
|
+
else
|
293
|
+
nrFailures += 1
|
294
|
+
$errors[nummer] = Marke.new(bezeichnung, elem.elements[2].text, elem.elements[3].text, land, elem.elements[5].text,
|
295
|
+
zeile_1, zeile_2, zeile_3, zeile_4, plz, ort )
|
296
|
+
end
|
297
|
+
}
|
298
|
+
puts "Es gab #{nrFailures} Fehler beim lesen von #{filename}" if $VERBOSE
|
299
|
+
end
|
300
|
+
|
301
|
+
pp 1
|
302
|
+
parse_swissreg(timespan)
|
303
|
+
pp 2
|
304
|
+
fetchresult
|
305
|
+
$errors.each{
|
306
|
+
|markennummer, info|
|
307
|
+
fetchDetails(markennummer)
|
308
|
+
}
|
309
|
+
|
310
|
+
CSV.open('ausgabe.csv', 'w') do |csv|
|
311
|
+
$results.each{ |x| csv << x }
|
312
|
+
end
|
data/spike_watir.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# require 'selenium'
|
4
|
+
require 'watir'
|
5
|
+
require 'watir-webdriver'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
# zum schnell von Hand testen
|
10
|
+
# client = Selenium::WebDriver::Remote::Http::Default.new
|
11
|
+
# client.timeout = 180 # seconds – default is 60
|
12
|
+
|
13
|
+
$cnt = 1
|
14
|
+
def saveStep(b, cnt = $cnt)
|
15
|
+
name = "watir/#{__FILE__}_#{cnt}.html".sub('.rb','')
|
16
|
+
ausgabe = File.open(name, "w+")
|
17
|
+
ausgabe.write(b.html)
|
18
|
+
$cnt += 1 if $cnt.to_i != 0
|
19
|
+
|
20
|
+
end
|
21
|
+
Swiss_reg_URL = 'https://www.swissreg.ch'
|
22
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
23
|
+
browser = Watir::Browser.new :firefox #, :http_client => client
|
24
|
+
# browser = Watir::Browser.new :chrome #, :http_client => client
|
25
|
+
browser.goto Swiss_reg_URL
|
26
|
+
#browser = Watir::Browser.start "https://www.swissreg.ch"
|
27
|
+
saveStep(browser, 11)
|
28
|
+
browser.link(:id, "id_swissreg_sub_nav_ipiNavigation_item0").click
|
29
|
+
saveStep(browser, 12 )
|
30
|
+
browser.link(:id, "id_swissreg_sub_nav_ipiNavigation_item0_item3").click
|
31
|
+
saveStep(browser, 13 )
|
32
|
+
browser.text_field(:id, "id_swissreg:mainContent:id_txf_appDate").set("1.10.2011-5.10.2011")
|
33
|
+
saveStep(browser, 14 )
|
34
|
+
browser.button(:value,"suchen").click
|
35
|
+
saveStep(browser, 15)
|
36
|
+
aus = browser.text
|
37
|
+
ausgabe=File.open('watir/liste.txt','w+')
|
38
|
+
ausgabe.puts aus
|
39
|
+
ausgabe.close
|
40
|
+
browser.link(:id, "id_swissreg:mainContent:data:2:tm_no_detail:id_detail").click# puts browser.text
|
41
|
+
browser.images.each do |x|
|
42
|
+
idx += 1
|
43
|
+
# apparently the string accepted by the string method will not allow variable substitution
|
44
|
+
location = 'img_' + idx.to_s + '.png'
|
45
|
+
x.save(location)
|
46
|
+
end
|
47
|
+
puts browser.url
|
48
|
+
pp browser.windows.each{ |w|
|
49
|
+
pp w.url
|
50
|
+
# saveStep(w)
|
51
|
+
}
|
52
|
+
# window2 = Watir::Browser.attach(:url, "https://www.swissreg.ch/srclient/faces/jsp/trademark/sr30.jsp") stackLevel too deep
|
53
|
+
#window2 = Selenium::WebDriver::Firefox.attach(:url, "https://www.swissreg.ch/srclient/faces/jsp/trademark/sr30.jsp")
|
54
|
+
#saveStep(window2)
|
55
|
+
#aus = window2.text
|
56
|
+
ausgabe=File.open('watir/detail.txt','w+')
|
57
|
+
ausgabe.puts aus
|
58
|
+
ausgabe.close
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brand2csv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Niklaus Giger, Zeno R.R. Davatz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: mechanize
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.6'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '4.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '4.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: webmock
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: hoe
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3.4'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
94
|
+
description: ! "brand2csv creates csv files for swiss brand registered in a specific
|
95
|
+
time period. \n The csv contains the brand, link to image (if present), link to
|
96
|
+
the detailinfo at swissreg.ch, name and address of owner (Inhaber)"
|
97
|
+
email: yasaka@ywesee.com, zdavatz@ywesee.com
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files:
|
101
|
+
- History.txt
|
102
|
+
- LICENCE.txt
|
103
|
+
- Manifest.txt
|
104
|
+
- README.md
|
105
|
+
files:
|
106
|
+
- .gitignore
|
107
|
+
- .rspec
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- History.txt
|
111
|
+
- LICENCE.txt
|
112
|
+
- LICENSE
|
113
|
+
- Manifest.txt
|
114
|
+
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- lib/brand2csv.rb
|
117
|
+
- lib/brand2csv/version.rb
|
118
|
+
- protocol.2013.05.12.textile
|
119
|
+
- protocol.2013.05.15.textile
|
120
|
+
- protocol.2013.05.21.textile
|
121
|
+
- resultat_1.html
|
122
|
+
- spike.rb
|
123
|
+
- spike_mechanize_swissreg.rb
|
124
|
+
- spike_watir.rb
|
125
|
+
homepage: https://github.com/zdavatz/brand2csv
|
126
|
+
licenses: []
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options:
|
129
|
+
- --main
|
130
|
+
- README.md
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project: brand2csv
|
147
|
+
rubygems_version: 1.8.23
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: brand2csv creates csv files for swiss brands.
|
151
|
+
test_files: []
|