-
-
Notifications
You must be signed in to change notification settings - Fork 198
/
shein.js
40 lines (31 loc) · 945 Bytes
/
shein.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
import {
findNode,
processNode,
makeDocumentVisible,
runOnce
} from 'utils/common';
import {setFileInputData, initSearch, sendReceipt} from 'utils/engines';
const engine = 'shein';
async function search({session, search, image, storageIds}) {
// close upload progress popup
processNode('.c-modal-wrap[tip="uploading"] button', node => node.click(), {
throwError: false
});
// close promotion popup
processNode('.in-pop-inner button.btn-shop-now', node => node.click(), {
throwError: false
});
(await findNode('i.search-upload__icon')).click();
const inputSelector = '.search-upload input[type="file"]';
const input = await findNode(inputSelector);
await setFileInputData(inputSelector, input, image);
await sendReceipt(storageIds);
input.dispatchEvent(new Event('change'));
}
function init() {
makeDocumentVisible();
initSearch(search, engine, taskId);
}
if (runOnce('search')) {
init();
}