-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
63 lines (59 loc) · 2.29 KB
/
index.js
File metadata and controls
63 lines (59 loc) · 2.29 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
54
55
56
57
58
59
60
61
62
63
require("dotenv").config();
const config = require("config");
const playwright = require("playwright");
var Promise = require("bluebird");
(async () => {
for (const browserType of ["chromium"]) {
const browser = await playwright[browserType].launch({
headless: false,
slowMo: 50,
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(config.hilan.pages.loginPage);
await page.fill("#user_nm", config.hilan.username);
await page.fill("#password_nm", config.hilan.password);
await page.click("button");
// const frames = await page.frames();
// const newframe = frames[1];
// const newframehandle = newframe.contentFrame();
// await newframehandle.click('css=input:text("שמור וסגור")');
for (i = 0; i < 30; i++) {
// next page\
const mainFrame = await page.mainFrame();
await mainFrame.click(
`css=.TableContentData >> css=.UserTasksItem:nth-child(${config.hilan.startingDayIndex}) >> css=span`
);
await Promise.delay(1000);
const elementHandle = await page.$("#ErrFrame");
await Promise.delay(1000);
const frame = await elementHandle.contentFrame();
await Promise.delay(1000);
// await frame.click('css=input:text("שמור וסגור")'); // working
await frame.click(
"css=tr.gridRowStyle >> css=td.ItemCell:first-child >> css=input"
);
await page.keyboard.press("ArrowLeft");
await page.keyboard.press("ArrowLeft");
await page.keyboard.press("Digit0");
await page.keyboard.press("Digit9");
await page.keyboard.press("Digit0");
await page.keyboard.press("Digit0");
await page.keyboard.press("Digit1");
await page.keyboard.press("Digit9");
await page.keyboard.press("Digit0");
await page.keyboard.press("Digit0");
await frame.click('css=input:text("שמור וסגור")'); // working
await Promise.delay(2000);
await page.keyboard.press("Enter");
await Promise.delay(1000);
}
// await frame.fill(
// "css=tr.gridRowStyle >> css=td.ItemCell:first-child >> css=input",
// "0900"
// );
console.log("went to page");
await page.screenshot({ path: `example-${browserType}.png` });
await browser.close();
}
})();