ferrumwizard 0.2.0 → 0.2.3

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: 4b012bc3e8cb9b91311c91eecef6b816cae7bc3d179dc037ac0011373e1d54d2
4
- data.tar.gz: f0421333194ed8b204ea87beab02314a44f978bbafa28809622b89d1db26bd4f
3
+ metadata.gz: 8013b78b7811e2a20b4af98c5790ae95c45476d378128b8d31ac6901367b5966
4
+ data.tar.gz: 50f9410288e51618ba32c4fbeb31254ac84a7bedfd5c16c5d6749a2fdf5e7ade
5
5
  SHA512:
6
- metadata.gz: b96dd21840cbed0d1253f4795ddf4a4cf36250d5d3736b918c70c7c48ef63d4e8ba31592395cce6de691049a076f41186337a92643e3e1748e122f58edc51905
7
- data.tar.gz: 39d7c5cc96e6900db1bbfa668ba9b972d49f09147d0fc5b079c34fd40e7235bb256a1713c1bf5725a16c0087dca959d5df8b12b7f10e093891478bf0a33f53f2
6
+ metadata.gz: 1b13345e5b6b413926d6ef3e5dc0312d22683b1e04eac42822f6064d04550294fd70cc373b234d273363e826bcb68e18ea3d2b6022683d0bdc47b62f8420a726
7
+ data.tar.gz: b584c4e9b189c1fa3cb22de1a0e6e2198972487be7082efb2dd0c81df7770fe594d89bcd5efc3fb6be781cbae0f49bb7ccbeb3dae6034c51d57b45ae68858868
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/ferrumwizard.rb CHANGED
@@ -11,16 +11,22 @@ class FerrumWizard
11
11
 
12
12
  attr_reader :browser, :links, :radio, :buttons, :js_methods
13
13
 
14
- def initialize(url=nil, headless: true, timeout: 10, debug: false)
14
+ def initialize(url=nil, headless: true, timeout: 10, cookies: nil,
15
+ debug: false)
15
16
 
16
17
  @url, @debug = url, debug
17
18
  @browser = Ferrum::Browser.new headless: headless, timeout: timeout
18
- sleep 3
19
19
 
20
- if url
20
+ loadx(cookies) if cookies
21
+
22
+ if url then
23
+
24
+ sleep 3
25
+
21
26
  @browser.goto(@url)
22
27
  @browser.network.wait_for_idle
23
28
  sleep 4
29
+
24
30
  end
25
31
  end
26
32
 
@@ -42,16 +48,18 @@ class FerrumWizard
42
48
  # url='https://somewebsite.com'
43
49
  # fw.browser.goto(url)
44
50
  #
45
- def load_cookies(filepath)
51
+ def load_cookies(raws)
52
+
53
+ s = raws.lines.length > 1 ? raws : File.read(raws)
46
54
 
47
- rawcookies = YAML.load(File.read(filepath))
55
+ rawcookies = YAML.load(s)
48
56
 
49
57
  rawcookies.each do |h|
50
58
 
51
59
  if @debug then
52
60
  puts 'name: ' + h['name']
53
61
  puts 'h: ' + h.inspect
54
- sleep 0.7
62
+ sleep 0.4
55
63
  end
56
64
 
57
65
  browser.cookies.set(name: h['name'], value: h['value'],
@@ -61,6 +69,8 @@ class FerrumWizard
61
69
 
62
70
  end
63
71
 
72
+ alias loadx load_cookies
73
+
64
74
  def login(usernamex=nil, passwordx=nil, username: usernamex, password: passwordx)
65
75
 
66
76
  puts 'username: ' + username.inspect if @debug
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrumwizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  FK+cyrQNA9DLJYJuz6uO7Z+gXZWjwAO38LUwF01w49asSv/5ZH2HH/EauX5xWpe+
36
36
  ry6lYQlb8j50Iys5elAy1p0i
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-30 00:00:00.000000000 Z
38
+ date: 2022-04-13 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rexle
metadata.gz.sig CHANGED
Binary file