From cc70d71972d41689de3a2cdcfa8499ad33b542be Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Wed, 15 Jan 2025 21:26:32 +0100 Subject: [PATCH] docs: explain launchOption --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52ad71b..7d6c9ff 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ libraryDependencies += "com.google.guava" % "guava" % "33.0.0-jre" ## Compatibility notes ### Scala versions * This library can be used with any scala version 2.x and 3.x -* This project is compiled with scala 2.12.18 +* This project is compiled with scala 2.12.20 ### sbt versions * This library can be used with any sbt version 1.x ### Playwright versions -* This library can be used with playwright version 1.40.0 `"com.microsoft.playwright" % "playwright" % "1.40.0"` +* This library can be used with playwright version 1.49.0 `"com.microsoft.playwright" % "playwright" % "1.49.0"` ### JDK versions * This library is tested on JDK11 and JDK21 @@ -56,6 +56,51 @@ jsEnv := new jsenv.playwright.PWEnv( ) ``` +## Launch options + +The launch options are used to enable/disable the browser features. They can be overridden via the launchOptions parameter or extended via the additionalLaunchOptions parameter. + +When not passing launchOptions, default launch options are as follows: + +### Chrome/chromium +```scala +jsEnv := new jsenv.playwright.PWEnv( + browserName = "chrome", + launchOptions = List( + "--disable-extensions", + "--disable-web-security", + "--allow-running-insecure-content", + "--disable-site-isolation-trials", + "--allow-file-access-from-files", + "--disable-gpu" + ) +) +``` + +### Firefox +```scala +jsEnv := new jsenv.playwright.PWEnv( + browserName = "firefox", + launchOptions = List( + "--disable-web-security" + ) +) +``` + +### Webkit +```scala +jsEnv := new jsenv.playwright.PWEnv( + browserName = "webkit", + launchOptions = List( + "--disable-extensions", + "--disable-web-security", + "--allow-running-insecure-content", + "--disable-site-isolation-trials", + "--allow-file-access-from-files" + ) +) +``` + ## KeepAlive configuration It is work in progress. As a workaround introducing delay in the test cases may help to keep the browser alive.