stealth_browser_automation 1.1.1 → 1.1.3
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.
- checksums.yaml +4 -4
- data/lib/browserfactory.rb +22 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed895a94dc114b6d80a33b866ace99988972647e
|
4
|
+
data.tar.gz: df42e543c218299d617104d7c2cc48d1eb656357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc75a4959b09a4005a4720e10c91d73c776db50637b54a83bc31fbc2f6f253ca23da186bf39c83df61bef207a9b634156985d323594f9b4f2a81ce8afe5c99b
|
7
|
+
data.tar.gz: 84c5532f8c8a7e43b99b92132a94a0da89c9dc62aa1f2eb846df1f0efade75695ad1d81478251db31da654d4873153d1a2b237b13775ede9b40debd06a5562a4
|
data/lib/browserfactory.rb
CHANGED
@@ -127,6 +127,7 @@ module BlackStack
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def push_screenshot(filename=nil)
|
130
|
+
=begin
|
130
131
|
filename = "#{PROCESS.fullWorkerName}.png" if filename.nil?
|
131
132
|
BrowserFactory::screenshot(filename)
|
132
133
|
|
@@ -160,6 +161,7 @@ module BlackStack
|
|
160
161
|
if parsed['status'] != "success"
|
161
162
|
raise "Error Uploading Screenshot: #{parsed['status']}"
|
162
163
|
end
|
164
|
+
=end
|
163
165
|
end
|
164
166
|
|
165
167
|
def back
|
@@ -181,9 +183,9 @@ module BlackStack
|
|
181
183
|
end
|
182
184
|
|
183
185
|
def goto(url)
|
184
|
-
self.notify("goto")
|
186
|
+
# self.notify("goto")
|
185
187
|
super
|
186
|
-
BlackStack::BrowserFactory.browser.push_screenshot
|
188
|
+
# BlackStack::BrowserFactory.browser.push_screenshot
|
187
189
|
end
|
188
190
|
|
189
191
|
def screenshot
|
@@ -279,7 +281,7 @@ module BlackStack
|
|
279
281
|
|
280
282
|
def self.updateProfileList()
|
281
283
|
addPidToProfileList(@@profile_name, @@pid)
|
282
|
-
PROCESS.list().select { |p| p[:ppid] == @@pid && p[:executablepath] =~ /chrome\.exe/ }.each { |p2|
|
284
|
+
PROCESS.list().select { |p| p[:ppid] == @@pid && (p[:executablepath] =~ /chrome\.exe/ || p[:executablepath] =~ /mimic\.exe/) }.each { |p2|
|
283
285
|
addPidToProfileList(@@profile_name, p2[:pid])
|
284
286
|
}
|
285
287
|
end
|
@@ -436,30 +438,29 @@ module BlackStack
|
|
436
438
|
@@profile_name = mimic_profile_id
|
437
439
|
url_2 = nil
|
438
440
|
i = 0
|
439
|
-
max =
|
441
|
+
max = 3
|
440
442
|
while (i<max && url_2.nil?)
|
441
443
|
i += 1
|
444
|
+
|
442
445
|
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port}/api/v1/profile/start?automation=true&profileId=#{@@profile_name}"
|
443
446
|
uri = URI.parse(url)
|
444
|
-
|
445
|
-
res =
|
446
|
-
|
447
|
-
}
|
448
|
-
res = JSON.parse(res.body)
|
447
|
+
body = Net::HTTP.get(uri)
|
448
|
+
res = JSON.parse(body)
|
449
|
+
|
449
450
|
if !res.has_key?('status')
|
450
|
-
if i
|
451
|
+
if i>=max
|
451
452
|
self.release() # libero el flag de reserva de turno para crar un browser
|
452
|
-
raise "Error
|
453
|
+
raise "Error requesting Mimic to start (try #{i.to_s}): #{res.to_s}"
|
453
454
|
end
|
454
455
|
elsif res['status'] != 'OK'
|
455
|
-
if i
|
456
|
+
if i>=max
|
456
457
|
self.release() # libero el flag de reserva de turno para crar un browser
|
457
|
-
raise "Error
|
458
|
+
raise "Error requesting Mimic to start (try #{i.to_s}): #{res.to_s}"
|
458
459
|
end
|
459
460
|
else
|
460
461
|
url_2 = res['value']
|
461
|
-
end
|
462
|
-
end
|
462
|
+
end # if !res.has_key?('status')
|
463
|
+
end # while
|
463
464
|
|
464
465
|
if !url_2.nil?
|
465
466
|
#uri_2 = URI.parse(url_2)
|
@@ -467,19 +468,19 @@ module BlackStack
|
|
467
468
|
#res_2 = Net::HTTP.start(uri_2.host, uri_2.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
|
468
469
|
# http.request(req_2)
|
469
470
|
#}
|
470
|
-
@@driver = Selenium::WebDriver.for(:remote, :url => url_2
|
471
|
+
@@driver = Selenium::WebDriver.for(:remote, :url => url_2)
|
471
472
|
bridge = @@driver.instance_variable_get(:@bridge)
|
472
473
|
service = bridge.instance_variable_get(:@service)
|
473
474
|
process = service.instance_variable_get(:@process)
|
474
475
|
@@pid = process.pid.to_s # es el PID del chromedriver
|
475
476
|
@@driver.manage.window().maximize()
|
476
|
-
@@browser = Watir::Browser.new(@@driver)
|
477
|
+
@@browser = PampaBrowser.new(@@driver) # Watir::Browser.new(@@driver)
|
477
478
|
self.updateProfileList
|
478
479
|
end
|
479
480
|
|
480
481
|
rescue => e
|
481
482
|
p1 = PROCESS.list().select { |p| p[:ppid] == PROCESS.pid && p[:executablepath] =~ /chromedriver(.*)\.exe/ }.first
|
482
|
-
if
|
483
|
+
if !p1.nil?
|
483
484
|
@@pid = p1[:pid]
|
484
485
|
self.updateProfileList
|
485
486
|
end
|
@@ -492,6 +493,9 @@ module BlackStack
|
|
492
493
|
|
493
494
|
# libero el flag de reserva de turno para crar un browser
|
494
495
|
self.release()
|
496
|
+
|
497
|
+
#
|
498
|
+
@@browser
|
495
499
|
end
|
496
500
|
|
497
501
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth_browser_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|