From 2a5f9a2e7b6f28b1e081c6f29320f493e811a876 Mon Sep 17 00:00:00 2001 From: amaechi hope Date: Thu, 31 Oct 2024 15:21:34 +0100 Subject: [PATCH] docs(dotnet): fix code snippets for GoToAsync --- docs/src/api/class-keyboard.md | 2 +- docs/src/api/class-locatorassertions.md | 2 +- docs/src/api/class-page.md | 6 +++--- docs/src/api/class-request.md | 6 +++--- docs/src/clock.md | 4 ++-- docs/src/events.md | 6 +++--- docs/src/mock.md | 8 ++++---- docs/src/navigations.md | 4 ++-- docs/src/network.md | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/src/api/class-keyboard.md b/docs/src/api/class-keyboard.md index f86c4ad11f..dfd4f25d43 100644 --- a/docs/src/api/class-keyboard.md +++ b/docs/src/api/class-keyboard.md @@ -290,7 +290,7 @@ browser.close() ``` ```csharp -await page.GotoAsync("https://keycode.info"); +await Page.GotoAsync("https://keycode.info"); await page.Keyboard.PressAsync("A"); await page.ScreenshotAsync(new() { Path = "A.png" }); await page.Keyboard.PressAsync("ArrowLeft"); diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index b48b3fce7e..ae613ea0e9 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -2138,7 +2138,7 @@ expect(page.locator('body')).to_match_aria_snapshot(''' ``` ```csharp -await page.GotoAsync("https://demo.playwright.dev/todomvc/"); +await Page.GotoAsync("https://demo.playwright.dev/todomvc/"); await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@" - heading ""todos"" - textbox ""What needs to be done?"" diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 2254221505..b993d8384d 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -3191,7 +3191,7 @@ await page.AddLocatorHandlerAsync(Page.GetByText("Sign up to the newsletter"), a }); // Write the test as usual. -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); await page.GetByRole("button", new() { Name = "Start here" }).ClickAsync(); ``` @@ -3248,7 +3248,7 @@ await page.AddLocatorHandlerAsync(Page.GetByText("Confirm your security details" }); // Write the test as usual. -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); await page.GetByRole("button", new() { Name = "Start here" }).ClickAsync(); ``` @@ -3305,7 +3305,7 @@ await page.AddLocatorHandlerAsync(page.Locator("body"), async () => { }, new() { NoWaitAfter = true }); // Write the test as usual. -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); await page.GetByRole("button", new() { Name = "Start here" }).ClickAsync(); ``` diff --git a/docs/src/api/class-request.md b/docs/src/api/class-request.md index e13d9de69f..e7ab7dcbfa 100644 --- a/docs/src/api/class-request.md +++ b/docs/src/api/class-request.md @@ -214,7 +214,7 @@ print(response.request.redirected_from.url) # "http://example.com" ``` ```csharp -var response = await page.GotoAsync("http://www.microsoft.com"); +var response = await Page.GotoAsync("http://www.microsoft.com"); Console.WriteLine(response.Request.RedirectedFrom?.Url); // http://www.microsoft.com ``` @@ -241,7 +241,7 @@ print(response.request.redirected_from) # None ``` ```csharp -var response = await page.GotoAsync("https://www.google.com"); +var response = await Page.GotoAsync("https://www.google.com"); Console.WriteLine(response.Request.RedirectedFrom?.Url); // null ``` @@ -368,7 +368,7 @@ print(request.timing) ```csharp var request = await page.RunAndWaitForRequestFinishedAsync(async () => { - await page.GotoAsync("https://www.microsoft.com"); + await Page.GotoAsync("https://www.microsoft.com"); }); Console.WriteLine(request.Timing.ResponseEnd); ``` diff --git a/docs/src/clock.md b/docs/src/clock.md index ea14941d82..0d69bdbc88 100644 --- a/docs/src/clock.md +++ b/docs/src/clock.md @@ -266,7 +266,7 @@ assertThat(page.getByText("You have been logged out due to inactivity.")).isVisi ```csharp // Initial time does not matter for the test, so we can pick current time. await Page.Clock.InstallAsync(); -await page.GotoAsync("http://localhost:3333"); +await Page.GotoAsync("http://localhost:3333"); // Interact with the page await page.GetByRole("button").ClickAsync(); @@ -375,7 +375,7 @@ await Page.Clock.InstallAsync(new() { TimeDate = new DateTime(2024, 2, 2, 8, 0, 0, DateTimeKind.Pst) }); -await page.GotoAsync("http://localhost:3333"); +await Page.GotoAsync("http://localhost:3333"); var locator = page.GetByTestId("current-time"); // Pause the time flow, stop the timers, you now have manual control diff --git a/docs/src/events.md b/docs/src/events.md index 060a855638..983bd66719 100644 --- a/docs/src/events.md +++ b/docs/src/events.md @@ -45,7 +45,7 @@ print(first.value.url) ```csharp var waitForRequestTask = page.WaitForRequestAsync("**/*logo*.png"); -await page.GotoAsync("https://wikipedia.org"); +await Page.GotoAsync("https://wikipedia.org"); var request = await waitForRequestTask; Console.WriteLine(request.Url); ``` @@ -152,11 +152,11 @@ void listener(object sender, IRequest request) Console.WriteLine("Request finished: " + request.Url); }; page.RequestFinished += listener; -await page.GotoAsync("https://wikipedia.org"); +await Page.GotoAsync("https://wikipedia.org"); // Remove previously added listener. page.RequestFinished -= listener; -await page.GotoAsync("https://www.openstreetmap.org/"); +await Page.GotoAsync("https://www.openstreetmap.org/"); ``` ## Adding one-off listeners diff --git a/docs/src/mock.md b/docs/src/mock.md index cc84887397..b9054f0037 100644 --- a/docs/src/mock.md +++ b/docs/src/mock.md @@ -73,7 +73,7 @@ await page.RouteAsync("*/**/api/v1/fruits", async route => { }); // Go to the page -await page.GotoAsync("https://demo.playwright.dev/api-mocking"); +await Page.GotoAsync("https://demo.playwright.dev/api-mocking"); // Assert that the Strawberry fruit is visible await Expect(Page.GetByTextAsync("Strawberry")).ToBeVisibleAsync(); @@ -185,7 +185,7 @@ await page.RouteAsync("*/**/api/v1/fruits", async (route) => { } ); // Go to the page -await page.GotoAsync("https://demo.playwright.dev/api-mocking"); +await Page.GotoAsync("https://demo.playwright.dev/api-mocking"); // Assert that the Loquat fruit is visible await Expect(Page.GetByTextAsync("Loquat", new () { Exact = true })).ToBeVisibleAsync(); @@ -280,7 +280,7 @@ await page.RouteFromHARAsync("./hars/fruit.har", new () { }); // Go to the page -await page.GotoAsync("https://demo.playwright.dev/api-mocking"); +await Page.GotoAsync("https://demo.playwright.dev/api-mocking"); // Assert that the fruit is visible await Expect(Page.GetByText("Strawberry")).ToBeVisibleAsync(); @@ -376,7 +376,7 @@ await page.RouteFromHARAsync("./hars/fruit.har", new () ); // Go to the page -await page.GotoAsync("https://demo.playwright.dev/api-mocking"); +await Page.GotoAsync("https://demo.playwright.dev/api-mocking"); // Assert that the Playwright fruit is visible await page.ExpectByTextAsync("Playwright", new() { Exact = true }).ToBeVisibleAsync(); diff --git a/docs/src/navigations.md b/docs/src/navigations.md index 9e307e43c3..491152dcf5 100644 --- a/docs/src/navigations.md +++ b/docs/src/navigations.md @@ -33,7 +33,7 @@ page.goto("https://example.com") ```csharp // Navigate the page -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); ``` The code above loads the page and waits for the web page to fire the @@ -88,7 +88,7 @@ page.get_by_text("example domain").click() ```csharp // Navigate and click element // Click will auto-wait for the element -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); await Page.GetByText("Example Domain").ClickAsync(); ``` diff --git a/docs/src/network.md b/docs/src/network.md index e1cd4ed656..3fdd8d24ce 100644 --- a/docs/src/network.md +++ b/docs/src/network.md @@ -476,7 +476,7 @@ page.goto("https://example.com") await page.RouteAsync("**/api/fetch_data", async route => { await route.FulfillAsync(new() { Status = 200, Body = testData }); }); -await page.GotoAsync("https://example.com"); +await Page.GotoAsync("https://example.com"); ``` ## Modify requests