Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With playwright #85

Merged
merged 15 commits into from Jun 3, 2020
Merged

With playwright #85

merged 15 commits into from Jun 3, 2020

Conversation

jlandure
Copy link
Member

At the moment, this is the result:

docker container run -it --rm -v $(pwd)/src:/usr/src/app/src --cap-add=SYS_ADMIN zenika/alpine-chrome:with-playwright npm start

> zenika-alpinechrome-withplaywright@1.0.0 start /usr/src/app
> node src/useragent

browser <launching> /usr/bin/chromium-browser --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_dev_profile-MlhBee --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-startup-window
browser <launched> pid=31
protocol SEND ► {"id":1,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true}}
Chromium 81.0.4044.122 

browser:err [0510/170953.730359:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
protocol ◀ RECV {"id":1,"result":{}}
protocol SEND ► {"id":2,"method":"Target.createBrowserContext","params":{"disposeOnDetach":true}}
protocol ◀ RECV {"id":2,"result":{"browserContextId":"6728FCC7E6FBD429C7E3A71D412DD421"}}
protocol SEND ► {"id":3,"method":"Browser.setDownloadBehavior","params":{"behavior":"deny","browserContextId":"6728FCC7E6FBD429C7E3A71D412DD421","downloadPath":"/tmp/playwright_downloads-kNgjBf"}}
protocol ◀ RECV {"error":{"code":-32601,"message":"'Browser.setDownloadBehavior' wasn't found"},"id":3}
(node:17) UnhandledPromiseRejectionWarning: Error: Protocol error (Browser.setDownloadBehavior): 'Browser.setDownloadBehavior' wasn't found
    at /usr/src/app/node_modules/playwright-core/lib/chromium/crConnection.js:130:63
    at new Promise (<anonymous>)
    at CRSession.send (/usr/src/app/node_modules/playwright-core/lib/chromium/crConnection.js:129:16)
    at CRSession.<anonymous> (/usr/src/app/node_modules/playwright-core/lib/helper.js:64:31)
    at CRBrowserContext._initialize (/usr/src/app/node_modules/playwright-core/lib/chromium/crBrowser.js:251:36)
    at CRBrowser.newContext (/usr/src/app/node_modules/playwright-core/lib/chromium/crBrowser.js:95:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/src/app/src/useragent.js:20:19
  -- ASYNC --
    at CRBrowser.<anonymous> (/usr/src/app/node_modules/playwright-core/lib/helper.js:63:23)
    at /usr/src/app/src/useragent.js:20:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@ghost
Copy link

ghost commented May 11, 2020

I think that there is a problem with the chrome version dixit some comments available here: https://stackoverflow.com/questions/45631715/downloading-with-chrome-headless-and-selenium

@Niek
Copy link

Niek commented May 26, 2020

Playwright depends on CDP functionality that is only available in Chromium 84. So either you need to build Chromium from source (84 stable release date is somewhere in July), or patch the Playwright code.

@jlandure
Copy link
Member Author

Hi @Niek 👋

Thanks for the news. 👌

I don't think I got the time to investigate the build of Chrome at the moment... 😅
I propose to wait for the availability of Chrome 84 to continue the tests with Playwright. What do you think?

@Niek
Copy link

Niek commented May 26, 2020

I tried patching Playwright but the changes are too severe to work around it (e.g. major changes around the browser contexts). I think the best bet would be to get a beta Chromium build working based on https://git.alpinelinux.org/aports/tree/community/chromium/APKBUILD

@jlandure
Copy link
Member Author

Hi @Niek

I'm ok with this idea 💡

But... for your information, the compilation takes 1,5 days if I quote to this comment #28 (comment)

And we can't add this feature using the Docker Hub for the compilation.

In this comment, we can see the current limits here

I've contacted their support team, and according to their response, the current limits on Automated Builds are:

2 hours
2 GB RAM
1 CPU
30 GB Disk Space

@Niek
Copy link

Niek commented May 26, 2020

Yes the builds are crazy slow. I have opened a MR for chromium 83 (latest stable): https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/8463

If that goes well I'll try to create a chromium-beta aport.

@Niek
Copy link

Niek commented Jun 3, 2020

Chromium 83 is now in aports: https://git.alpinelinux.org/aports/commit/?id=0400e89dfb72eeadb513a46934b9bfdc258df2d0

Playwright 1.0+ needs Chromium 84+, but in my tests the 83 build seems to work fine. So I think this PR can be merged :)

Edit: recent Firefox builds also have CDP support built-in now, so theoretically you can also use Playwright with FF on Alpine.

@ghost
Copy link

ghost commented Jun 3, 2020

Chromium 83 is now in aports: https://git.alpinelinux.org/aports/commit/?id=0400e89dfb72eeadb513a46934b9bfdc258df2d0

Playwright 1.0+ needs Chromium 84+, but in my tests the 83 build seems to work fine. So I think this PR can be merged :)

awesome, excited about that

@jlandure
Copy link
Member Author

jlandure commented Jun 3, 2020

Hi @Niek and @lucmichalski 👋

I will check that now! Thanks for the info! 🙌

renovate bot and others added 11 commits June 3, 2020 14:57
Co-authored-by: Renovate Bot <bot@renovateapp.com>
* ✨ play with deno 🦕

* ✏️ end of file
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
@jlandure jlandure marked this pull request as ready for review June 3, 2020 12:58
@jlandure jlandure merged commit 152d310 into master Jun 3, 2020
@jlandure jlandure deleted the with-playwright branch June 3, 2020 12:59
@jlandure
Copy link
Member Author

jlandure commented Jun 3, 2020

@all-contributors please add @Niek for question and ideas

@allcontributors
Copy link
Contributor

@jlandure

I've put up a pull request to add @Niek! 🎉

@jlandure
Copy link
Member Author

jlandure commented Jun 3, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants