Skip to content

Commit

Permalink
Clean up the main examples page
Browse files Browse the repository at this point in the history
  • Loading branch information
bdurrani authored and kblok committed Oct 11, 2018
1 parent 89eeb55 commit 61713a5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docfx_project/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Puppeteer Sharp

Puppeteer Sharp is a .NET port of the official [Node.JS Puppeteer API](https://github.com/GoogleChrome/puppeteer).
Puppeteer Sharp is a .NET port of the official [Node.JS Puppeteer API](https://github.com/GoogleChrome/puppeteer).

# Prerequisites

Expand All @@ -24,7 +24,6 @@ await page.ScreenshotAsync(outputFile);

You can also change the view port before generating the screenshot


```cs
await page.SetViewport(new ViewPortOptions
{
Expand All @@ -33,7 +32,6 @@ await page.SetViewport(new ViewPortOptions
});
```


## Generate PDF files

```cs
Expand All @@ -50,7 +48,7 @@ await page.PdfAsync(outputFile);
## Inject HTML

```cs
using(var page = await Browser.NewPageAsync())
using(var page = await browser.NewPageAsync())
{
await page.SetContentAsync("<div>My Receipt</div>");
var result = await page.GetContentAsync();
Expand All @@ -62,9 +60,9 @@ using(var page = await Browser.NewPageAsync())
## Evaluate Javascript

```cs
using (var page = await Browser.NewPageAsync())
using (var page = await browser.NewPageAsync())
{
var seven = await page.EvaluateFunctionAsync<int>(4 + 3);
var seven = await page.EvaluateFunctionAsync<int>("()=> 4 + 3");
var someObject = await page.EvaluateFunctionAsync<dynamic>("(value) => ({a: value})", 5);
Console.WriteLine(someObject.a);
}
Expand All @@ -73,7 +71,7 @@ using (var page = await Browser.NewPageAsync())
## Wait For Selector

```cs
using (var page = await Browser.NewPageAsync())
using (var page = await browser.NewPageAsync())
{
await page.GoToAsync("http://www.spapage.com");
await page.WaitForSelectorAsync("div.main-content")
Expand All @@ -82,12 +80,13 @@ using (var page = await Browser.NewPageAsync())
```

## Wait For Function

```cs
using (var page = await Browser.NewPageAsync())
{
await page.GoToAsync("http://www.spapage.com");
var watchDog = page.WaitForFunctionAsync("window.innerWidth < 100");
await Page.SetViewport(new ViewPortOptions { Width = 50, Height = 50 });
var watchDog = page.WaitForFunctionAsync(" () => window.innerWidth < 100");
await page.SetViewportAsync(new ViewPortOptions { Width = 50, Height = 50 });
await watchDog;
}
```
Expand Down

0 comments on commit 61713a5

Please sign in to comment.