-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCustomWindows.java
More file actions
40 lines (30 loc) · 1.26 KB
/
Copy pathCustomWindows.java
File metadata and controls
40 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package examples;
import com.osiris.headlessbrowser.HBrowser;
import com.osiris.headlessbrowser.windows.LightWindow;
import com.osiris.headlessbrowser.windows.PlaywrightWindow;
import com.osiris.headlessbrowser.windows.PuppeteerWindow;
import org.junit.jupiter.api.Test;
public class CustomWindows {
@Test
void test() {
HBrowser hBrowser = new HBrowser();
// You can further customize the window like this:
try (PlaywrightWindow playwrightWindow = hBrowser.openCustomWindow()
.debugOutputStream(System.out).headless(true).jsTimeout(5) // etc.
.buildPlaywrightWindow()) {
// ...
}
// There are multiple types of windows you can build.
// Remember that it's important to close the windows, that's why we use the try/catch block,
// which will auto-close the window when we leave the block.
try (PlaywrightWindow playwrightWindow = hBrowser.openCustomWindow().buildPlaywrightWindow()) {
// ...
}
try (PuppeteerWindow puppeteerWindow = hBrowser.openCustomWindow().buildPuppeteerWindow()) {
// ...
}
try (LightWindow lightWindow = hBrowser.openCustomWindow().buildLightWindow()) {
// ...
}
}
}