stealth_browser_automation 1.1.26 → 1.1.31
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 +25 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d082fe944c4ad48a19be6254853441e85f64a41c
|
4
|
+
data.tar.gz: 4961762eedb988c6c36c3c991f187f413a174c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762a6bd971516651623fb84dc66b3b2f6f744f7c8c5ab61132267b23221af1870536d5b7479442d686418af47e79eea734b10fdd16140531df7f58146506eb3f
|
7
|
+
data.tar.gz: 3dd168f43758e6b0b1fc04497e2140ec9422657c104388c58ccc9e2efa9d280504cbef3182b91edbb894a372ca608d9250fb830a2c0d1482edddb28cd5584323
|
data/lib/browserfactory.rb
CHANGED
@@ -566,6 +566,7 @@ module BlackStack
|
|
566
566
|
end
|
567
567
|
|
568
568
|
elsif @@type == BlackStack::BrowserFactory::TYPE_MIMIC
|
569
|
+
=begin
|
569
570
|
puts ''
|
570
571
|
begin
|
571
572
|
print 'Close browser?... '
|
@@ -580,28 +581,43 @@ puts 'no'
|
|
580
581
|
rescue => e
|
581
582
|
puts "error: #{e.to_s}"
|
582
583
|
end
|
584
|
+
=end
|
583
585
|
=begin
|
584
586
|
begin
|
585
587
|
# TODO: entender porque debo hacer esta llamada a start para que el perfil se cierre cuando ya estaba iniciado
|
586
|
-
|
588
|
+
puts ''
|
589
|
+
print 'Close browser?... '
|
590
|
+
if !@@profile_name.nil?
|
591
|
+
puts 'yes'
|
592
|
+
print 'Close browser... '
|
593
|
+
BlackStack::BrowserFactory.mimic(@@profile_name)
|
594
|
+
puts 'done'
|
595
|
+
print 'Close browser (2)... '
|
596
|
+
@@browser.close
|
597
|
+
puts 'done'
|
598
|
+
else
|
599
|
+
puts 'no'
|
600
|
+
end
|
587
601
|
rescue
|
588
602
|
# nothing here
|
589
603
|
end
|
590
604
|
=end
|
605
|
+
|
591
606
|
i = 0
|
592
|
-
max =
|
593
|
-
success =
|
594
|
-
|
607
|
+
max = 6
|
608
|
+
success = 0
|
609
|
+
max_success_required = 2
|
610
|
+
while i<max && success<max_success_required
|
595
611
|
i+=1
|
596
|
-
|
597
|
-
|
612
|
+
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port}/api/v1/profile/stop?profileId=#{@@profile_name}"
|
613
|
+
print "Api Call ##{i.to_s} to: #{url}... "
|
598
614
|
uri = URI.parse(url)
|
599
615
|
body = Net::HTTP.get(uri)
|
600
616
|
res = JSON.parse(body)
|
601
|
-
success
|
617
|
+
success += 1 if res['status'].to_s == 'OK'
|
602
618
|
puts "response: #{res['status'].to_s}"
|
603
|
-
end # while i<max
|
604
|
-
raise "Error requesting Mimic to stop (tried #{i.to_s} times)" if
|
619
|
+
end # while i<max && && success<max_success_required
|
620
|
+
raise "Error requesting Mimic to stop (tried #{i.to_s} times)" if success<max_success_required
|
605
621
|
|
606
622
|
else
|
607
623
|
raise 'Cannot destroy browser due unknown browser type'
|