-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.js
More file actions
53 lines (38 loc) · 2.05 KB
/
test2.js
File metadata and controls
53 lines (38 loc) · 2.05 KB
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
50
51
52
53
console.log('hello world');
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch({ headless: false, slowMo: 50 });
const page = await browser.newPage();
// Set screen size
await page.setViewport({ width: 1080, height: 1024 });
await page.goto('https://systemobsluginajmu.pl/login');
const textSelector = await page.waitForSelector('text/System');
const fullTitle = await textSelector.evaluate((el) => el.textContent);
// Type into search box
await page.type('.form-control.m-input.placeholder-no-fix', 'artur@aexol.com');
await page.type('.form-control.placeholder-no-fix.m-input.m-login__form-input--last', 'XzNuegFg3jLGuaX');
// Wait and click on first result
//const searchResultSelector = '.search-box__link';
//await page.waitForSelector(searchResultSelector);
//await page.click(searchResultSelector);
const login = await page.waitForSelector('div >.btn.btn-focus.m-btn.m-btn--pill.m-btn--custom.m-btn--air');
await login.click({ delay: 100 });
const select = await page.waitForSelector('text/Nieruchomości');
await select.click('text/Nieruchomości', { delay: 100 });
const addNew = await page.waitForSelector('a[class="btn btn-success"]');
await addNew.click({ delay: 100 });
await page.click('a[class="btn.btn-success"]');
// await page.waitForSelector('div >.form-control', 'Name');
await page.waitForSelector('input[name="division_name"]');
await page.type('input[name="division_name"]', 'Name');
await page.type('input[name="division_shortname"]', 'CompanyName');
await page.type('input[name="division_address"]', 'Address');
await page.type('input[name="division_city"]', 'City');
await page.type('input[name="division_zip"]', 'Zip');
//await page.type('select[name="division_country_id"]', '41');
await page.type('input[name="division_account"]', '93828404804444444');
const submit = await page.waitForSelector('div >.btn.green');
await submit.click({ delay: 100 });
console.log('The title of this blog post is "%s".', fullTitle);
//await browser.close();
})();