mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
docs: fix java code snippets (#8319)
This commit is contained in:
parent
5357b2f280
commit
3aae170b03
@ -166,7 +166,7 @@ await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.js
|
||||
|
||||
```java
|
||||
page.route("**/xhr_endpoint", route -> route.fulfill(
|
||||
new Route.FulfillOptions().setPath(Paths.get("mock_data.json")));
|
||||
new Route.FulfillOptions().setPath(Paths.get("mock_data.json"))));
|
||||
```
|
||||
|
||||
```python async
|
||||
|
@ -28,19 +28,19 @@ await context.tracing.stop({ path: 'trace.zip' });
|
||||
```
|
||||
|
||||
```java
|
||||
Browser browser = chromium.launch();
|
||||
Browser browser = browserType.launch();
|
||||
BrowserContext context = browser.newContext();
|
||||
|
||||
// Start tracing before creating / navigating a page.
|
||||
context.tracing.start(new Tracing.StartOptions()
|
||||
context.tracing().start(new Tracing.StartOptions()
|
||||
.setScreenshots(true)
|
||||
.setSnapshots(true);
|
||||
.setSnapshots(true));
|
||||
|
||||
Page page = context.newPage();
|
||||
page.goto("https://playwright.dev");
|
||||
page.navigate("https://playwright.dev");
|
||||
|
||||
// Stop tracing and export it into a zip archive.
|
||||
context.tracing.stop(new Tracing.StopOptions()
|
||||
context.tracing().stop(new Tracing.StopOptions()
|
||||
.setPath(Paths.get("trace.zip")));
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user