jofh22 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/jofh22.rb +144 -0
- data.tar.gz.sig +0 -0
- metadata +110 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7dcdc2521319123e2c811fcf7a3cbb43c1ab4e003277e43d3cfb0cc15c0df09d
|
4
|
+
data.tar.gz: b384667c9c65ba2a6f36a00a84a78c2a8a81f7451b2c3d021df37365bbca8562
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3721a5cfd7dac65d6c49c5dce0473f79a6c74b105145c50a6a35768543ce9566419a46e102c59528ff048d5d925a12e34fc29986f50a6e9f7c3fd9a374159807
|
7
|
+
data.tar.gz: 42749c78d3ec47283c6bdec4170dcabcdc8853198227e5aef4e96fa57de464ac71c388441d1058ff94690837471d0a6648f0107818560251ab133bdcea17300c
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/jofh22.rb
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: jofh22.rb
|
4
|
+
|
5
|
+
# description: Jobs Online form helper 2022 (Experimental)
|
6
|
+
|
7
|
+
require 'yaml'
|
8
|
+
require 'ferrumwizard'
|
9
|
+
require 'nokorexi'
|
10
|
+
|
11
|
+
|
12
|
+
module Jofh22
|
13
|
+
|
14
|
+
class NHSScot
|
15
|
+
|
16
|
+
attr_reader :browser, :h, :doc
|
17
|
+
|
18
|
+
# notes:
|
19
|
+
#
|
20
|
+
# * the *cookies* parameter can reference a file path to save or
|
21
|
+
# read a cookie file
|
22
|
+
# * the *yml* parameter refeference the YAML file containing the inputs
|
23
|
+
#
|
24
|
+
def initialize(yml='/tmp/tmp.yaml', cookies: nil, debug: false)
|
25
|
+
|
26
|
+
@debug = debug
|
27
|
+
url = 'https://apply.jobs.scot.nhs.uk/register.aspx'
|
28
|
+
@browser = browser = FerrumWizard.new(url, headless: false,
|
29
|
+
cookies: cookies)
|
30
|
+
sleep 1
|
31
|
+
@doc = Nokorexi.new(browser.body).to_doc
|
32
|
+
sleep 1
|
33
|
+
|
34
|
+
filepath = yml
|
35
|
+
@h = YAML.load(File.read(filepath))
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def populate_form()
|
40
|
+
|
41
|
+
h, browser = @h, @browser
|
42
|
+
r = browser.at_xpath('//select[@name="cmdTitle"]')
|
43
|
+
|
44
|
+
# Title
|
45
|
+
# options: , Councillor, Doctor, Father, Friar, Lady, Lord, Major,
|
46
|
+
# Miss, Mr., Mrs., Ms., Mx., Professor, Reverend, Sir
|
47
|
+
title = h['title']
|
48
|
+
titles = %w( Councillor Doctor Father Friar Lady Lord Major Miss Mr.) +
|
49
|
+
%w(Mrs. Ms. Mx. Professor Reverend Sir)
|
50
|
+
r = titles.grep /#{title}/i
|
51
|
+
n = titles.index(r.first) + 1
|
52
|
+
r = browser.at_xpath('//div[select/@name="cmdTitle"]')
|
53
|
+
r.focus
|
54
|
+
n.times { r.type(:down); sleep 0.4}
|
55
|
+
r.click
|
56
|
+
sleep 0.5
|
57
|
+
|
58
|
+
r = browser.at_xpath('//input[@name="txtForename"]')
|
59
|
+
|
60
|
+
# First name
|
61
|
+
first_name = h['first_name']
|
62
|
+
r.focus.type first_name
|
63
|
+
sleep 0.5
|
64
|
+
|
65
|
+
r = browser.at_xpath('//input[@name="txtSurname"]')
|
66
|
+
|
67
|
+
# Last name
|
68
|
+
last_name = h['last_name']
|
69
|
+
r.focus.type last_name
|
70
|
+
sleep 0.5
|
71
|
+
|
72
|
+
r = browser.at_xpath('//input[@name="txtHomePostcode"]')
|
73
|
+
|
74
|
+
# Postcode
|
75
|
+
postcode = h['postcode']
|
76
|
+
r.focus.type postcode
|
77
|
+
sleep 0.5
|
78
|
+
|
79
|
+
r = browser.at_xpath('//input[@name="txtHomeTelephone"]')
|
80
|
+
|
81
|
+
# Home Telephone
|
82
|
+
home_telephone = h['home_telephone']
|
83
|
+
r.focus.type '+' + home_telephone.to_s.sub(/^\+/,'')
|
84
|
+
sleep 0.5
|
85
|
+
|
86
|
+
r = browser.at_xpath('//input[@name="recoveryOption"]')
|
87
|
+
r.focus.click
|
88
|
+
|
89
|
+
r = browser.at_xpath('//input[@name="txtHomeEmail"]')
|
90
|
+
|
91
|
+
# Email address
|
92
|
+
email_address = h['email_address']
|
93
|
+
r.focus.type email_address
|
94
|
+
sleep 0.5
|
95
|
+
|
96
|
+
r = browser.at_xpath('//input[@name="txtPassword"]')
|
97
|
+
|
98
|
+
# Password
|
99
|
+
password = h['password']
|
100
|
+
r.focus.type password
|
101
|
+
sleep 0.5
|
102
|
+
|
103
|
+
r = browser.at_xpath('//input[@name="txtPassword2"]')
|
104
|
+
|
105
|
+
# Re-type password
|
106
|
+
retype_password = h['retype_password']
|
107
|
+
r.focus.type retype_password
|
108
|
+
sleep 0.5
|
109
|
+
|
110
|
+
r = browser.at_xpath('//select[@name="cmbEmployed"]')
|
111
|
+
sleep 0.5
|
112
|
+
# Are you currently employed by NHS Scotland?
|
113
|
+
# options: Please select, Yes, No
|
114
|
+
ayceb = h['ayceb']
|
115
|
+
titles = ['Please select', 'Yes', 'No']
|
116
|
+
puts 'ayceb: ' + ayceb.inspect if @debug
|
117
|
+
puts 'titles: ' + titles.inspect if @debug
|
118
|
+
|
119
|
+
r2 = titles.grep /#{ayceb}/i
|
120
|
+
puts 'r2: ' + r2.inspect if @debug
|
121
|
+
n = titles.index(r2.first) + 1
|
122
|
+
r = browser.at_xpath('//div[select/@name="cmbEmployed"]')
|
123
|
+
r.focus
|
124
|
+
n.times { r.type(:down); sleep 0.4}
|
125
|
+
r.click
|
126
|
+
sleep 0.5
|
127
|
+
|
128
|
+
r = browser.at_xpath('//input[@name="Termscheckbox"]')
|
129
|
+
r.focus.click
|
130
|
+
|
131
|
+
r = browser.at_xpath('//button[@type="submit"]')
|
132
|
+
r.focus.click
|
133
|
+
|
134
|
+
#r.focus.type(:enter)
|
135
|
+
sleep 2
|
136
|
+
browser.save_cookies(cookie_filepath)
|
137
|
+
puts 'cookies saved to ' + cookie_filepath
|
138
|
+
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jofh22
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNTI5MDk0NjM5WhcN
|
15
|
+
MjMwNTI5MDk0NjM5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDOCxEO
|
17
|
+
us/eoqaF2gMPNSQsrCfM/YVNFhewKUUnmVizDkglYuGeHaVqgdXAbJ73Bqeo9RM3
|
18
|
+
/7eYNXTpQ54PFD+tmLf74r0Jm6/oi+JOCKUpllk5obeTn0X35kHlxlbZJqc6BXho
|
19
|
+
xRtlveen8zZdIZU6EbH3E7f1YMSPoQ96hLTUFen1sH2oo3HViEECC0SQTLOQTCnj
|
20
|
+
pIPyPRpWZduwx+UfJX4f0fDJz2ecHfnEKfero2Vu6Nd76wGNiSjknIebOhbNGEJg
|
21
|
+
YppmRRvHiICcSQncQ+jxrrhhtdFWjouFI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FCeM970TfCe+6ZwjFwlykWw
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2022-05-29 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: ferrumwizard
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.3'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.3.3
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.3'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.3.3
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: nokorexi
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.7'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.7.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.7'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.7.0
|
80
|
+
description:
|
81
|
+
email: digital.robertson@gmail.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- lib/jofh22.rb
|
87
|
+
homepage: https://github.com/jrobertson/jofh22
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubygems_version: 3.2.22
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Jobs Online form helper 2022 (Experimental)
|
110
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|