Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1032268 // Test Playwright (cross-browser web automation library, OK!)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 65776K of libraries. Click here for Pure Java version (7918L/40K).

!7

!include once #1032300 // Playwright

cm TestPlaywright > DynSingleFunctionWithPrintLog {
  switchable S url = "https://gaz.ai";
  switchable double secondsBeforeScreenshot;
  
  void doIt {
    fixContextClassLoader();
    temp Playwright playwright = Playwright.create();
    print("Using Chromium");
    Browser browser = playwright.chromium().launch();
    print("Virtual browser started");
    Page page = browser.newPage();
    page.navigate(url);
    print("Page title for " + url + ": " + page.title());
    
    print("Sleeping for " + secondsBeforeScreenshot);
    sleepSeconds(secondsBeforeScreenshot);
    print("Trying to get a screenshot");
    byte[] buffer = page.screenshot();
    BufferedImage img = imageFromBytes(buffer);
    dm_showImage(url, img);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032268
Snippet name: Test Playwright (cross-browser web automation library, OK!)
Eternal ID of this version: #1032268/10
Text MD5: 9495d77e32e36c8beb21dd9d82ae3bb4
Transpilation MD5: 8abdc29f81b09bab8befdb12e311a562
Author: stefan
Category: javax / networking
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-27 01:59:09
Source code size: 804 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 552
Version history: 9 change(s)
Referenced in: #1032301 - tempPlaywright - be sure to clean it up
#1032302 - playwrightChromium
#1032303 - playwrightOpenPage