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 +4 -4
- data/adspower-client.gemspec +2 -2
- data/lib/adspower-client.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a4cbcbdabbd1f597745c5604f03d3eb052d998f81a5167737a552060d8c65af
|
4
|
+
data.tar.gz: 05b42ad5140074a8488d4b9424fd6d723873daf3c901c5317352076aafc050b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c58297ba76e0c27b72d3c79ef185bf02814620869f2deb873820bfba211564e05cb728615623036d26683c0c0b9a6448e78cec85d1cff3fc14bdec6ed51e66
|
7
|
+
data.tar.gz: 73537e1167da16936197c508bdb76c055d772bde2ef5b9666d67bf9e2da92de1b6355e2f73897dd190bec009959757fcba40d16348d75f6722da6f6930d4f5b1
|
data/adspower-client.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'adspower-client'
|
3
|
-
s.version = '1.0.
|
4
|
-
s.date = '2024-
|
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"]
|
data/lib/adspower-client.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri
|