stealth_browser_automation 1.1.3 → 1.1.4
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 +31 -16
- 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: 8595a0cb4230cc2aab3e5f85e7dd92c6c8d98a67
|
4
|
+
data.tar.gz: 0fe97b4dc8135b43a05e284ad030f4736cdf5df5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f79b507eccd85c9c9730bf3af9bc35aaa15d216e98262be8bf630b5be38cd28f0f981dd078ce394fb7606712e4b43e142e75dbfa1de6105059ae8396727f5df
|
7
|
+
data.tar.gz: 4df2367a7ed411e97c71d77f3964712ffdb0a7c429a927f00c4b607223dceaf90aecdefe9950b7d8d5d61f526341f8e15a240a5cadf21519c9a7f3af1c155994
|
data/lib/browserfactory.rb
CHANGED
@@ -289,6 +289,7 @@ module BlackStack
|
|
289
289
|
TYPE_PHANTOMJS = 0 # discontinued!
|
290
290
|
TYPE_FIREFOX = 1
|
291
291
|
TYPE_CHROME = 2
|
292
|
+
TYPE_MIMIC = 3
|
292
293
|
|
293
294
|
@@fd = File.open(LOCKING_FILENAME,"w")
|
294
295
|
@@fd_profile = nil
|
@@ -296,6 +297,7 @@ module BlackStack
|
|
296
297
|
@@browser = nil
|
297
298
|
@@pid = nil
|
298
299
|
@@profile_name = nil
|
300
|
+
@@type = nil
|
299
301
|
|
300
302
|
def self.browser()
|
301
303
|
@@browser
|
@@ -376,19 +378,30 @@ module BlackStack
|
|
376
378
|
end
|
377
379
|
|
378
380
|
def self.destroy()
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
@@browser.close
|
388
|
-
|
381
|
+
if @@type = BlackStack::BrowserFactory::TYPE_CHROME
|
382
|
+
self.lockProfileList()
|
383
|
+
self.readPidToProfileList(@@profile_name).each { |pid|
|
384
|
+
MyProcess.kill(pid)
|
385
|
+
self.removePidToProfileList(@@profile_name, pid)
|
386
|
+
}
|
387
|
+
self.releaseProfileList()
|
388
|
+
begin
|
389
|
+
@@browser.close if !@@browser.nil?
|
390
|
+
rescue => e
|
391
|
+
#
|
389
392
|
end
|
390
|
-
|
391
|
-
|
393
|
+
elsif @@type = BlackStack::BrowserFactory::TYPE_MIMIC
|
394
|
+
@@browser.close if !@@browser.nil?
|
395
|
+
begin
|
396
|
+
BlackStack::BrowserFactory.mimic(@@profile_name)
|
397
|
+
rescue
|
398
|
+
# nothing here
|
399
|
+
end
|
400
|
+
url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port}/api/v1/profile/stop?profileId=#{@@profile_name}"
|
401
|
+
uri = URI.parse(url)
|
402
|
+
body = Net::HTTP.get(uri)
|
403
|
+
res = JSON.parse(body)
|
404
|
+
if res['status'].to_s != 'OK'
|
392
405
|
end
|
393
406
|
# reseteo las variables
|
394
407
|
@@browser = nil
|
@@ -435,6 +448,7 @@ module BlackStack
|
|
435
448
|
# Levantar el flag de reserva a mi favor
|
436
449
|
self.lock()
|
437
450
|
|
451
|
+
@@type = BlackStack::BrowserFactory::TYPE_MIMIC
|
438
452
|
@@profile_name = mimic_profile_id
|
439
453
|
url_2 = nil
|
440
454
|
i = 0
|
@@ -469,10 +483,10 @@ module BlackStack
|
|
469
483
|
# http.request(req_2)
|
470
484
|
#}
|
471
485
|
@@driver = Selenium::WebDriver.for(:remote, :url => url_2)
|
472
|
-
bridge = @@driver.instance_variable_get(:@bridge)
|
473
|
-
service = bridge.instance_variable_get(:@service)
|
474
|
-
process = service.instance_variable_get(:@process)
|
475
|
-
|
486
|
+
#bridge = @@driver.instance_variable_get(:@bridge)
|
487
|
+
#service = bridge.instance_variable_get(:@service)
|
488
|
+
#process = service.instance_variable_get(:@process)
|
489
|
+
#@@pid = process.pid.to_s # es el PID del chromedriver
|
476
490
|
@@driver.manage.window().maximize()
|
477
491
|
@@browser = PampaBrowser.new(@@driver) # Watir::Browser.new(@@driver)
|
478
492
|
self.updateProfileList
|
@@ -503,6 +517,7 @@ module BlackStack
|
|
503
517
|
#
|
504
518
|
@@browser = nil
|
505
519
|
@@driver = nil
|
520
|
+
@@type = BlackStack::BrowserFactory::TYPE_CHROME
|
506
521
|
@@profile_name = profile_name
|
507
522
|
|
508
523
|
#
|
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.4
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|