amazon_auth 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/lib/amazon_auth/client.rb +5 -13
- data/lib/amazon_auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb189eb92ba2db5dcf11bc40d40bda8bc490ea2
|
4
|
+
data.tar.gz: 2498a86f72cabefebef0682de2debe8697cf841d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df882ca03728ed34c328f76cb4607836e1dda1185093fd7af1df4e40080ef746fbb72a5377a4dee5f1a3cc5d941c7f1060c75e69562a26e911578910c1f97da1
|
7
|
+
data.tar.gz: 2af1a90785ec4f78770feb83e90b141de50a1d155697c7dd213137ce03c5f7c3431bc66dee6c49b4d3e7293a17f9e6f87f2611ebe9d1127eb8c4ecb42bddec48
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,8 @@ If the browser doesn't work, try selenium-webdriver version '~> 2.0' or differen
|
|
47
47
|
Run `amazon_auth` and paste the output to _.env_.
|
48
48
|
(`AMAZON_USERNAME_CODE` , `AMAZON_PASSWORD_CODE` and `AMAZON_CODE_SALT`)
|
49
49
|
|
50
|
+
![amazon_auth_setup](https://cloud.githubusercontent.com/assets/275284/25064607/9b9b80be-2238-11e7-95fc-c1547a83f178.gif)
|
51
|
+
|
50
52
|
### Run
|
51
53
|
|
52
54
|
In console, you can move around pages using Capybara DSL
|
data/lib/amazon_auth/client.rb
CHANGED
@@ -25,8 +25,9 @@ module AmazonAuth
|
|
25
25
|
session.visit initial_url
|
26
26
|
session.first('#a-autoid-0-announce').click
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
sleep_s
|
29
|
+
session.fill_in 'ap_email', with: @login
|
30
|
+
session.fill_in 'ap_password', with: @password
|
30
31
|
session.click_on('signInSubmit')
|
31
32
|
|
32
33
|
while alert_displayed? do
|
@@ -38,23 +39,14 @@ module AmazonAuth
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def retry_sign_in
|
41
|
-
|
42
|
+
session.fill_in 'ap_password', with: @password
|
42
43
|
if image_recognition_displayed?
|
43
44
|
input = ask "Got the prompt. Read characters from the image: "
|
44
|
-
|
45
|
+
session.fill_in 'auth-captcha-guess', with: input
|
45
46
|
end
|
46
47
|
session.click_on('signInSubmit')
|
47
48
|
end
|
48
49
|
|
49
|
-
def fill_in_with_stroke(dom_id, value)
|
50
|
-
sleep_s
|
51
|
-
element = session.first("##{dom_id}")
|
52
|
-
value.split(//u).each do |char|
|
53
|
-
element.send_keys(char)
|
54
|
-
sleep rand
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
50
|
def alert_displayed?
|
59
51
|
session.has_selector?('.a-alert-container')
|
60
52
|
end
|
data/lib/amazon_auth/version.rb
CHANGED