diff --git a/.github/workflows/get-html.yml b/.github/workflows/get-html.yml index 39f7a6a8..06132d6d 100644 --- a/.github/workflows/get-html.yml +++ b/.github/workflows/get-html.yml @@ -21,9 +21,18 @@ jobs: run: | ls -la - uses: ./get-html + name: test some URL with: url: https://opentermsarchive.org output: result.html - shell: bash run: | cat result.html | grep Accessibilité + - uses: ./get-html + name: test user-agent + with: + url: https://httpbin.org/user-agent + output: user-agent.html + - shell: bash + run: | + cat user-agent.html | grep dashlord diff --git a/get-html/src/index.js b/get-html/src/index.js index 9eec561d..58113616 100644 --- a/get-html/src/index.js +++ b/get-html/src/index.js @@ -11,10 +11,11 @@ const getHTML = async (url) => { `--lang=${LANGUAGE}`, ], }); - + const userAgent = await browser.userAgent(); let html = ""; try { const page = await browser.newPage(); + await page.setUserAgent(`${userAgent} - dashlord`); await page.goto(url); await page.waitForTimeout(5000); // wait some time, some SPA may load asynchronously (ex: angular) const frame = await page.mainFrame();