fix: allow building persistent context options from device (#266)
This commit is contained in:
@@ -622,6 +622,14 @@ public interface BrowserType {
|
||||
this.viewport = Optional.ofNullable(viewport);
|
||||
return this;
|
||||
}
|
||||
public LaunchPersistentContextOptions withDevice(DeviceDescriptor device) {
|
||||
withViewport(device.viewport().width(), device.viewport().height());
|
||||
withUserAgent(device.userAgent());
|
||||
withDeviceScaleFactor(device.deviceScaleFactor());
|
||||
withIsMobile(device.isMobile());
|
||||
withHasTouch(device.hasTouch());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A path where Playwright expects to find a bundled browser executable.
|
||||
|
||||
@@ -1176,8 +1176,9 @@ class NestedClass extends TypeDefinition {
|
||||
}
|
||||
} else {
|
||||
writeBuilderMethods(output, bodyOffset);
|
||||
if ("Browser.newContext.options".equals(jsonPath) ||
|
||||
"Browser.newPage.options".equals(jsonPath)) {
|
||||
if (asList("Browser.newContext.options",
|
||||
"Browser.newPage.options",
|
||||
"BrowserType.launchPersistentContext.options").contains(jsonPath)) {
|
||||
writeDeviceDescriptorBuilder(output, bodyOffset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user