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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/browserfactory.rb +25 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d9cfbadc98d58e0115fa2b5e6dab39732a36a64
4
- data.tar.gz: 9047f3a14290b6a6d9bccf3aa491de7fc795f5d3
3
+ metadata.gz: d082fe944c4ad48a19be6254853441e85f64a41c
4
+ data.tar.gz: 4961762eedb988c6c36c3c991f187f413a174c1a
5
5
  SHA512:
6
- metadata.gz: 1f9606883aeac31c85feccb1e6f8736bf46da9b815df6c6b6ea5edf65a8c39d5a975abb637c70c8f2a34080f39f072f1f01f72ca3631ce64e97bb5a2fe05627f
7
- data.tar.gz: 2b3c4bd13546da1afac003d5b2f4d382c9100cb80e922737821a55ca881f58fc6921d1860640a06b0275774a59387acd28d0ffeea9bb0b2183a2bfe3b1318af8
6
+ metadata.gz: 762a6bd971516651623fb84dc66b3b2f6f744f7c8c5ab61132267b23221af1870536d5b7479442d686418af47e79eea734b10fdd16140531df7f58146506eb3f
7
+ data.tar.gz: 3dd168f43758e6b0b1fc04497e2140ec9422657c104388c58ccc9e2efa9d280504cbef3182b91edbb894a372ca608d9250fb830a2c0d1482edddb28cd5584323
@@ -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
- BlackStack::BrowserFactory.mimic(@@profile_name) if !@@profile_name.nil?
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 = 3
593
- success = false
594
- while i<max && !success
607
+ max = 6
608
+ success = 0
609
+ max_success_required = 2
610
+ while i<max && success<max_success_required
595
611
  i+=1
596
- print "Api Call #{i.to_s}... "
597
- url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port}/api/v1/profile/stop?profileId=#{@@profile_name}"
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 = true if res['status'].to_s == 'OK'
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 !success
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth_browser_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.26
4
+ version: 1.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi