playwright-java Browser, BrowserContext, and Page are pretty easy to understand, but this is the only one that has a little ......
package ;
/**
* BrowserType provides methods to launch a specific browser instance or connect to an existing one.
*
* BrowserType Provides a way to launch a specific browser or connect to an existing one.。
*/
public interface BrowserType {
// launch a browser Returns the browser instance
Browser launch(LaunchOptions options);
// pass (a bill or inspection etc) Chrome DevTools Protocol Connecting to an Existing Browser
Browser connectOverCDP(String endpointURL, ConnectOverCDPOptions options);
// Returns the browser name for example chromium webkit firefox
String name();
// Returns the executable browser path
String executablePath();
// ...
}
Debug the following code to see:
BrowserType is not simply a straightforward representation of theBrowser Type, but rather represents classes with a browser type and a browser executable path to launch or connect to a launched browser.
package demo;
import .*;
import ;
import ;
public class Demo {
public static void main(String[] args) {
try(Playwright playwright = ()) {
// all three BrowserType
List<BrowserType> browserTypes = (
(),
(),
()
);
launchOptions = new ().setHeadless(false);
// (math.) ergodic
for (BrowserType browserType : browserTypes) {
// launch a browser
try (Browser browser = (launchOptions)) {
BrowserContext context = ();
Page page = ();
("https://localhost/");
}
}
}
}
}
Well, that's on the map.initializer
Where is it coming from? And where is it going?
An important clue that's coming to light ......
Over this mountain, over that sea; add breaks to all the following methods, and believe, up and down, you will find the truth ......
- #createImpl
- #run
- #runUntil
- #processOneMessage
- #createRemoteObject
- #PlaywrightImpl
Huajianketang would climb every mountain, and swim every ocean, just to find you.