MCPcopy
hub / github.com/microsoft/playwright-python / new_page

Method new_page

playwright/_impl/_browser.py:185–233  ·  view source on GitHub ↗
(
        self,
        viewport: ViewportSize = None,
        screen: ViewportSize = None,
        noViewport: bool = None,
        ignoreHTTPSErrors: bool = None,
        javaScriptEnabled: bool = None,
        bypassCSP: bool = None,
        userAgent: str = None,
        locale: str = None,
        timezoneId: str = None,
        geolocation: Geolocation = None,
        permissions: Sequence[str] = None,
        extraHTTPHeaders: Dict[str, str] = None,
        offline: bool = None,
        httpCredentials: HttpCredentials = None,
        deviceScaleFactor: float = None,
        isMobile: bool = None,
        hasTouch: bool = None,
        colorScheme: ColorScheme = None,
        forcedColors: ForcedColors = None,
        contrast: Contrast = None,
        reducedMotion: ReducedMotion = None,
        acceptDownloads: bool = None,
        defaultBrowserType: str = None,
        proxy: ProxySettings = None,
        recordHarPath: Union[Path, str] = None,
        recordHarOmitContent: bool = None,
        recordVideoDir: Union[Path, str] = None,
        recordVideoSize: ViewportSize = None,
        storageState: Union[StorageState, str, Path] = None,
        baseURL: str = None,
        strictSelectors: bool = None,
        serviceWorkers: ServiceWorkersPolicy = None,
        recordHarUrlFilter: Union[Pattern[str], str] = None,
        recordHarMode: HarMode = None,
        recordHarContent: HarContentPolicy = None,
        clientCertificates: List[ClientCertificate] = None,
    )

Source from the content-addressed store, hash-verified

183 return context
184
185 async def new_page(
186 self,
187 viewport: ViewportSize = None,
188 screen: ViewportSize = None,
189 noViewport: bool = None,
190 ignoreHTTPSErrors: bool = None,
191 javaScriptEnabled: bool = None,
192 bypassCSP: bool = None,
193 userAgent: str = None,
194 locale: str = None,
195 timezoneId: str = None,
196 geolocation: Geolocation = None,
197 permissions: Sequence[str] = None,
198 extraHTTPHeaders: Dict[str, str] = None,
199 offline: bool = None,
200 httpCredentials: HttpCredentials = None,
201 deviceScaleFactor: float = None,
202 isMobile: bool = None,
203 hasTouch: bool = None,
204 colorScheme: ColorScheme = None,
205 forcedColors: ForcedColors = None,
206 contrast: Contrast = None,
207 reducedMotion: ReducedMotion = None,
208 acceptDownloads: bool = None,
209 defaultBrowserType: str = None,
210 proxy: ProxySettings = None,
211 recordHarPath: Union[Path, str] = None,
212 recordHarOmitContent: bool = None,
213 recordVideoDir: Union[Path, str] = None,
214 recordVideoSize: ViewportSize = None,
215 storageState: Union[StorageState, str, Path] = None,
216 baseURL: str = None,
217 strictSelectors: bool = None,
218 serviceWorkers: ServiceWorkersPolicy = None,
219 recordHarUrlFilter: Union[Pattern[str], str] = None,
220 recordHarMode: HarMode = None,
221 recordHarContent: HarContentPolicy = None,
222 clientCertificates: List[ClientCertificate] = None,
223 ) -> Page:
224 params = locals_to_params(locals())
225
226 async def inner() -> Page:
227 context = await self.new_context(**params)
228 page = await context.new_page()
229 page._owned_context = context
230 context._owner_page = page
231 return page
232
233 return await self._connection.wrap_api_call(inner, title="Create page")
234
235 async def close(self, reason: str = None) -> None:
236 self._close_reason = reason

Calls 2

locals_to_paramsFunction · 0.90
wrap_api_callMethod · 0.80