A JavaScript environment for Scala.js (a JSEnv) running playwright
Add the following line to your project/plugins.sbt
// For Scala.js 1.x libraryDependencies += "io.github.gmkumar2005" %% "scala-js-env-playwright" % "0.1.11"
Add the following line to your build.sbt
Test / jsEnv := new PWEnv( browserName = "chrome", headless = true, showLogs = true )
// For Scala.js 1.x scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
plugins.sbt
libraryDependencies += "com.google.guava" % "guava" % "33.0.0-jre"
"com.microsoft.playwright" % "playwright" % "1.49.0"
jsEnv := new jsenv.playwright.PWEnv( browserName = "chrome", headless = true, showLogs = false, )
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:
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" ) )
jsEnv := new jsenv.playwright.PWEnv( browserName = "firefox", launchOptions = List( "--disable-web-security" ) )
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" ) )
It is work in progress. As a workaround introducing delay in the test cases may help to keep the browser alive.
debug parameter can be passed to the PWEnv constructor to enable debugging. It will also display the version of the browser which is used.
Test / jsEnv := new PWEnv( browserName = "chrome", headless = true, showLogs = true, debug = true )
Watch this space for more details on how to use this library.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4