forked from karol-brejna-i/webpage-screenshot-action
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (33 loc) · 1.02 KB
/
scripting-basic.yml
File metadata and controls
35 lines (33 loc) · 1.02 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
name: "Browser scripting - basic"
run-name: ${{ github.actor }} is trying basic scripting 🚀
on:
workflow_dispatch:
jobs:
check_text:
name: Check if given text is present in the page (here, we are looking for 'World')
runs-on: ubuntu-latest
steps:
- uses: karol-brejna-i/webpage-screenshot-action@develop
with:
url: https://www.helloworld.org/
scriptBefore: |
if (element.innerText.includes('World')) {
console.log("Found!");
result = true;
} else {
console.log("Not found!");
result = false;
}
- run: |
ls
count_headers:
name: Count <h2> elements
runs-on: ubuntu-latest
steps:
- uses: karol-brejna-i/webpage-screenshot-action@develop
with:
url: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
scriptBefore: |
result = document.querySelectorAll('h2').length
- run: |
ls