adspower-client 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65fd0729b150916bca53b79d7170a4fd1a94743931b4d7b0f9b2cf35e1f6c494
4
- data.tar.gz: cb714f0f424bda981b6778de80e00dfce84b318fe091d2af8e91b5861aa24996
3
+ metadata.gz: 7a4cbcbdabbd1f597745c5604f03d3eb052d998f81a5167737a552060d8c65af
4
+ data.tar.gz: 05b42ad5140074a8488d4b9424fd6d723873daf3c901c5317352076aafc050b5
5
5
  SHA512:
6
- metadata.gz: a813f08b9ea6c25ecbffd99b8b8ecce3f1d7d2519449bc3c47d122bf8c2569741baddf062ac8020c38b666f16c81ebeaaafdc655a0a974e05db7a3707fdec076
7
- data.tar.gz: fa6b9980e22faa8be0e21572d46beb0bef54198e96f1feae5399de06497e7226bf917ed74a6de8201c725c3c20115045bfbb785fd03918fb68d1a84429cf89b9
6
+ metadata.gz: c9c58297ba76e0c27b72d3c79ef185bf02814620869f2deb873820bfba211564e05cb728615623036d26683c0c0b9a6448e78cec85d1cff3fc14bdec6ed51e66
7
+ data.tar.gz: 73537e1167da16936197c508bdb76c055d772bde2ef5b9666d67bf9e2da92de1b6355e2f73897dd190bec009959757fcba40d16348d75f6722da6f6930d4f5b1
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'adspower-client'
3
- s.version = '1.0.6'
4
- s.date = '2024-01-14'
3
+ s.version = '1.0.7'
4
+ s.date = '2024-02-07'
5
5
  s.summary = "Ruby library for operating AdsPower API."
6
6
  s.description = "Ruby library for operating AdsPower API."
7
7
  s.authors = ["Leandro Daniel Sardi"]
@@ -9,7 +9,10 @@ class AdsPowerClient
9
9
  # reference: https://localapi-doc-en.adspower.com/
10
10
  # reference: https://localapi-doc-en.adspower.com/docs/Rdw7Iu
11
11
  attr_accessor :key, :adspower_listener, :adspower_default_browser_version
12
- # attr_accessor :profiles_created
12
+
13
+ # control over the drivers created, in order to don't create the same driver twice and don't generate memory leaks.
14
+ # reference: https://github.com/leandrosardi/adspower-client/issues/4
15
+ @@drivers = {}
13
16
 
14
17
  def initialize(h={})
15
18
  self.key = h[:key] # mandatory
@@ -128,7 +131,11 @@ class AdsPowerClient
128
131
  #
129
132
  def driver(id, headless=false)
130
133
  ret = self.start(id, headless)
134
+ old = @@drivers[id]
131
135
 
136
+ # si este driver sigue activo, lo devuelvo
137
+ return old if old && self.check(id)
138
+
132
139
  # Attach test execution to the existing browser
133
140
  # reference: https://zhiminzhan.medium.com/my-innovative-solution-to-test-automation-attach-test-execution-to-the-existing-browser-b90cda3b7d4a
134
141
  url = ret['data']['ws']['selenium']
@@ -139,6 +146,9 @@ class AdsPowerClient
139
146
  # reference: https://localapi-doc-en.adspower.com/docs/K4IsTq
140
147
  driver = Selenium::WebDriver.for(:chrome, :options=>opts)
141
148
 
149
+ # save the driver
150
+ @@drivers[id] = driver
151
+
142
152
  # return
143
153
  driver
144
154
  end # def driver
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adspower-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
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: 2024-01-14 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri