1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Playwrightのメモ

Posted at

ブラウザをインストールしない

以下をつける。

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1

ほかのところだと忘れてうまくいかないので、
.npmrcにつけるとよい。
その後、必要なものを、以下のような感じで入れればOK

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 yarn add playwright-chromium

その他、もろもろのことをしたい場合には、Playwright/Installationを読むとよい。

DockerImage

mcr.microsoft.com/playwrightを使う。
chromium-844399、firefox-1225、webkit-1423、node v14.15.4等がインストール済み。

FROM mcr.microsoft.com/playwright

# 日本語化
RUN apt-get update && \
    apt-get -y install locales fonts-ipafont fonts-ipaexfont && \
    echo "ja_JP UTF-8" > /etc/locale.gen && locale-gen

RUN mkdir /usr/src/app

WORKDIR /usr/src/app

# playwrightを入れる。でも、browserはすでに入っているので、普通にpackage.json経由でOK
RUN yarn add playwright

COPY . .

CMD ["node", "./index.js"]
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?