forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhitelist.ts
More file actions
28 lines (24 loc) · 1.09 KB
/
whitelist.ts
File metadata and controls
28 lines (24 loc) · 1.09 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
import { type LaunchContext, sleep } from "./base"
export async function createWhitelist(context: LaunchContext, white: string) {
const whitePage = await context.openAppPage('/additional/whitelist')
const btn = await whitePage.waitForSelector('.el-button')
await btn?.click()
await sleep(.2)
const input = await whitePage.$('.el-select__input')
await input?.focus()
await whitePage.keyboard.type(white)
await sleep(.4)
const selectItem = await whitePage.waitForSelector('.el-popper .el-select-dropdown li:nth-child(1)')
await selectItem?.click()
await whitePage.click('.el-button:nth-child(3)')
const checkBtn = await whitePage.waitForSelector('.el-overlay.is-message-box .el-button.el-button--primary')
await checkBtn?.click()
setTimeout(() => whitePage.close(), 200)
}
export async function removeAllWhitelist(context: LaunchContext) {
const whitePage = await context.openAppPage('/additional/whitelist')
await whitePage.evaluate(async () => {
await chrome.storage.local.remove('__timer__WHITELIST')
})
await whitePage.close()
}