Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions images/chromium-headful/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ RUN set -eux; \
ln -sf /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
fi

# Install TypeScript and Playwright globally
RUN --mount=type=cache,target=/root/.npm,id=$CACHEIDPREFIX-npm npm install -g typescript playwright-core tsx
# Install TypeScript, Playwright, Patchright globally
RUN --mount=type=cache,target=/root/.npm,id=$CACHEIDPREFIX-npm npm install -g typescript playwright-core patchright tsx

# setup desktop env & app
ENV DISPLAY_NUM=1
Expand Down
4 changes: 4 additions & 0 deletions images/chromium-headful/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ RUN_ARGS=(
--mount type=bind,src="$FLAGS_FILE",dst=/chromium/flags,ro
)

if [[ -n "${PLAYWRIGHT_ENGINE:-}" ]]; then
RUN_ARGS+=( -e PLAYWRIGHT_ENGINE="$PLAYWRIGHT_ENGINE" )
fi

# WebRTC port mapping
if [[ "${ENABLE_WEBRTC:-}" == "true" ]]; then
echo "Running container with WebRTC"
Expand Down
4 changes: 2 additions & 2 deletions images/chromium-headless/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ RUN set -eux; \
ln -sf /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
fi

# Install TypeScript and Playwright globally
RUN --mount=type=cache,target=/root/.npm,id=$CACHEIDPREFIX-npm npm install -g typescript playwright-core tsx
# Install TypeScript, Playwright, Patchright globally
RUN --mount=type=cache,target=/root/.npm,id=$CACHEIDPREFIX-npm npm install -g typescript playwright-core patchright tsx

ENV WITHDOCKER=true

Expand Down
4 changes: 0 additions & 4 deletions images/chromium-headless/image/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ if [ -z "${CHROMIUM_FLAGS:-}" ]; then
--disable-breakpad \
--disable-client-side-phishing-detection \
--disable-component-extensions-with-background-pages \
--disable-component-update \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am little bit worry about deleting these flags because I dont what they are doing lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--disable-crash-reporter \
--disable-crashpad \
--disable-default-apps \
--disable-dev-shm-usage \
--disable-extensions \
--disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DeferRendererTasksAfterInput,DestroyProfileOnBrowserClose,DialMediaRouteProvider,ExtensionManifestV2Disabled,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameLoading,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate \
--disable-field-trial-config \
--disable-gcm-registration \
Expand All @@ -63,7 +60,6 @@ if [ -z "${CHROMIUM_FLAGS:-}" ]; then
--disable-renderer-backgrounding \
--disable-search-engine-choice-screen \
--disable-software-rasterizer \
--enable-automation \
--enable-use-zoom-for-dsf=false \
--export-tagged-pdf \
--force-color-profile=srgb \
Expand Down
4 changes: 4 additions & 0 deletions images/chromium-headless/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ RUN_ARGS=(
-v "$HOST_RECORDINGS_DIR:/recordings"
)

if [[ -n "${PLAYWRIGHT_ENGINE:-}" ]]; then
RUN_ARGS+=( -e PLAYWRIGHT_ENGINE="$PLAYWRIGHT_ENGINE" )
fi

# If a positional argument is given, use it as the entrypoint
ENTRYPOINT_ARG=()
if [[ $# -ge 1 && -n "$1" ]]; then
Expand Down
5 changes: 4 additions & 1 deletion server/runtime/playwright-executor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { readFileSync } from 'fs';
import { chromium } from 'playwright-core';
import { chromium as chromiumPW } from 'playwright-core';
import { chromium as chromiumPR } from 'patchright';

async function main() {
const codeFilePath = process.argv[2];
Expand All @@ -24,6 +25,8 @@ async function main() {
let result;

try {
const chromium = process.env.PLAYWRIGHT_ENGINE === 'patchright' ? chromiumPR : chromiumPW;

browser = await chromium.connectOverCDP('ws://127.0.0.1:9222');
const contexts = browser.contexts();
const context = contexts.length > 0 ? contexts[0] : await browser.newContext();
Expand Down
Loading