This repository has been archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
portal-ui-check1-2-1061.js
175 lines (145 loc) · 7.79 KB
/
portal-ui-check1-2-1061.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
const playwright = require('playwright');
const fs = require('fs');
const process = require('process');
(async () => {
// start する前に config を read する。node だからできること。
// ほかコマンドラインのパラメーターの受け渡しも可能
// inputjson, url, user, password, browsers, --head, --notification
// repository でまとめて管理
let inputjson = '';
let headlessflag = true;
let baseURL = '';
let user = '';
let userpassword = '';
let notification = false;
let scshocnt = 0;
let browserType = ''
for (let i = 0; i < process.argv.length; i++) {
let arg = process.argv[i];
console.log(arg);
if (arg.includes('inputjson')) {
inputjson = arg.split("=")[1];
console.log(inputjson)
}
if (arg.includes('url')) {
baseURL = arg.split("=")[1];
}
if (arg.includes('user')) {
user = arg.split("=")[1];
}
if (arg.includes('password')) {
userpassword = arg.split("=")[1];
}
if (arg.includes("--head")) {
headlessflag = false;
}
if (arg.includes("--notification")) {
notification = true;
}
if (arg.includes("browsers")) {
browserType = arg.split("=")[1]
}
}
if (inputjson !== '') {
let fileContents = fs.readFileSync(inputfile, 'utf8');
let config = JSON.parse(fileContents);
baseURL = config.initialurl
user = config.user
userpassword = config.userpassword
notification = config.notification
}
const browser = await playwright[browserType].launch({
headless: headlessflag,
slowMo: 3000
})
const context = await browser.newContext({
locale: 'ja-JP',
ignoreHTTPSErrors: true
})
const page = await context.newPage()
const navigationPromise = page.waitForNavigation()
await page.goto(baseURL+'/home/')
await page.waitForSelector('.clearfix > #header #login-link')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true });
scshocnt += 1;
await page.click('.clearfix > #header #login-link')
await navigationPromise
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true });
scshocnt += 1;
let frames = await page.frames()
const frame_119 = frames.find(f => f.url() === baseURL + '/sharing/rest/oauth2/authorize?client_id=arcgisonline&redirect_uri=' + baseURL +'/home/postsignin.html&response_type=token&display=iframe&parent=https://'+ hostname + '&expiration=20160&locale=ja')
await frame_119.waitForSelector('.formContainer > #oauth > #fieldSet #user_username')
await frame_119.click('.formContainer > #oauth > #fieldSet #user_username')
await frame_119.fill('.formContainer > #oauth > #fieldSet #user_username', user)
await frame_119.click('.formContainer > #oauth > #fieldSet #user_password')
await frame_119.fill('.formContainer > #oauth > #fieldSet #user_password', userpassword)
await frame_119.waitForSelector('#fieldSet > #ago-form #signIn')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true });
scshocnt += 1;
await frame_119.click('#fieldSet > #ago-form #signIn')
await navigationPromise
await page.waitForSelector('#page-border > #organizationWidget > #myOrgView > .esriFloatLeading > .section')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('#page-border > #organizationWidget > #myOrgView > .esriFloatLeading > .section')
await page.waitForSelector('#organization-control-div #organization-edit-button_label')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('#organization-control-div #organization-edit-button_label')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_19')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_19')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_18')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_18')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_20')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_20')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_21')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_21')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_22')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_22')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_23')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_23')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_24')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_24')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_25')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_25')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_26')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_26')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_27')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_27')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_28')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_28')
await page.waitForSelector('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_29')
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
await page.click('.esriFloatLeading > #editTabs > #editTabs_tablist #editTabs_tablist_dijit_layout_ContentPane_29')
await navigationPromise
await page.screenshot({ path: './'+scshocnt+'.png', fullPage: true })
scshocnt += 1
// Close page
await page.close();
// ---------------------
await context.close();
await browser.close();
})()