-
Notifications
You must be signed in to change notification settings - Fork 3
/
notes_guides.js
26 lines (22 loc) · 982 Bytes
/
notes_guides.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
// 3 ways to find an element with the tag "p" and click it
/*1 - */
await gnosisPage.evaluate(() => {
document.querySelectorAll("p").forEach(element => { if(element.innerText === "Awaiting your confirmation") element.click()})
})
/*2 - */
await gnosisPage.$$eval('p', x => {
x.forEach( xx => { if(xx.innerText === "Awaiting your confirmation") xx.click()})
})
/*3 - */
await gnosisPage.$$eval('p', selectorMatched => {
for(i in selectorMatched)
if(selectorMatched[i].textContent === 'Awaiting your confirmation'){
selectorMatched[i].click();
break;//Remove this line (break statement) if you want to click on all matched elements otherwise the first element only is clicked
}
});
//to click a certain element in the page with just the selector
await gnosisPage.evaluate(() => {
const firstTx = document.querySelectorAll('[data-testid="transaction-row"]')[0]
firstTx && firstTx.click()
})