-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (44 loc) · 1008 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var webdriverio = require('webdriverio');
/**
* Banpro username and password
* @type {Object}
*/
var account = {
username: '',
password: ''
};
/**
* Browser options
* @type {Object}
*/
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
var data = {
account: '',
balance: ''
};
var browser = webdriverio.remote(options).init();
browser.url('https://www.banpro.com.ni/banproenlinea/loginnic.asp')
.element('input[name="fldLoginNameT"]').setValue(account.username)
.execute(function() {
document.querySelector('input[name="fldPasswordT"]').value = account.password;
}, null)
.click('input[type="submit"]')
.getTitle().then(function(title) {
if (title === 'Productos') {
browser.getText('td.uno').then(function(values) {
data.account = values[0];
})
.getText('td.saldo').then(function(values) {
data.balance = values[1];
console.log(data);
})
.end();
} else {
console.log('Espera 5 min chele');
browser.end();
}
});