mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: fix website (#9935)
This commit is contained in:
parent
57e11b320c
commit
dcd8818399
@ -107,8 +107,8 @@ or [managing browsers yourself](https://pptr.dev/api/puppeteer.browserfetcher).
|
||||
If you are managing browsers yourself, you will need to call
|
||||
[`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with
|
||||
an an explicit
|
||||
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions.executablepath)
|
||||
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel) if it's
|
||||
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions)
|
||||
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's
|
||||
installed in a standard location).
|
||||
|
||||
When using `puppeteer-core`, remember to change the import:
|
||||
@ -177,7 +177,7 @@ import puppeteer from 'puppeteer';
|
||||
Puppeteer launches Chromium in
|
||||
[headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome).
|
||||
To launch a full version of Chromium, set the
|
||||
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless)
|
||||
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions)
|
||||
option when launching a browser:
|
||||
|
||||
```ts
|
||||
|
@ -193,7 +193,7 @@ There are two reasons for this:
|
||||
This means that Puppeteer does not support licensed formats such as AAC or
|
||||
H.264. (However, it is possible to force Puppeteer to use a
|
||||
separately-installed version Chrome instead of Chromium via the
|
||||
[`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions.executablepath).
|
||||
[`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions).
|
||||
You should only use this configuration if you need an official release of
|
||||
Chrome that supports these media formats.)
|
||||
- Since Puppeteer (in all configurations) controls a desktop version of
|
||||
|
@ -81,7 +81,7 @@ about the ambient environment is needed (in this case, `__dirname`).
|
||||
#### Enabling experiments
|
||||
|
||||
By default, experiments are turned off, but they can be individually turned on
|
||||
using the [`experiments`](../api/puppeteer.configuration.experiments) key.
|
||||
using the [`experiments`](../api/puppeteer.configuration) key.
|
||||
|
||||
For example, if you want to enable ARM-native macOS chromium, you can use
|
||||
|
||||
|
@ -23,13 +23,13 @@ before
|
||||
These methods can be used to debug any situation. These should be used as a
|
||||
quick sanity check before diving into more complex methods.
|
||||
|
||||
### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless)
|
||||
### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions)
|
||||
|
||||
Sometimes it's useful to see what the browser is displaying. Instead of
|
||||
launching in
|
||||
[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) mode,
|
||||
[`headless`](../api/puppeteer.browserlaunchargumentoptions) mode,
|
||||
launch a full version of the browser with
|
||||
[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) set to
|
||||
[`headless`](../api/puppeteer.browserlaunchargumentoptions) set to
|
||||
`false`:
|
||||
|
||||
```ts
|
||||
@ -38,7 +38,7 @@ const browser = await puppeteer.launch({headless: false});
|
||||
|
||||
### Puppeteer "slow-mo"
|
||||
|
||||
The [`slowMo`](../api/puppeteer.browserconnectoptions.slowmo) option slows down
|
||||
The [`slowMo`](../api/puppeteer.browserconnectoptions) option slows down
|
||||
Puppeteer operations by a specified amount of milliseconds. It's another way to
|
||||
help see what's going on.
|
||||
|
||||
@ -55,7 +55,7 @@ const browser = await puppeteer.launch({
|
||||
|
||||
Since client code runs in the browser, doing `console.*` in client code will not
|
||||
directly log to Node.js. However, you can [listen](../api/puppeteer.page.on) for
|
||||
the [`console`](../api/puppeteer.pageeventobject.console) event which returns a
|
||||
the [`console`](../api/puppeteer.pageeventobject) event which returns a
|
||||
payload with the logged text.
|
||||
|
||||
```ts
|
||||
@ -66,7 +66,7 @@ await page.evaluate(() => console.log(`url is ${location.href}`));
|
||||
|
||||
### Use the debugger in the browser
|
||||
|
||||
1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions.devtools) to
|
||||
1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions) to
|
||||
`true` when launching Puppeteer:
|
||||
|
||||
```ts
|
||||
@ -98,7 +98,7 @@ to this
|
||||
[Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=833928), so
|
||||
if you want to try something out, you have to add it to your test file.
|
||||
|
||||
1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) to
|
||||
1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions) to
|
||||
`false`.
|
||||
2. Add `debugger` to any server code you want debugged. For example,
|
||||
|
||||
|
@ -107,8 +107,8 @@ or [managing browsers yourself](https://pptr.dev/api/puppeteer.browserfetcher).
|
||||
If you are managing browsers yourself, you will need to call
|
||||
[`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with
|
||||
an an explicit
|
||||
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions.executablepath)
|
||||
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel) if it's
|
||||
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions)
|
||||
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's
|
||||
installed in a standard location).
|
||||
|
||||
When using `puppeteer-core`, remember to change the import:
|
||||
@ -177,7 +177,7 @@ import puppeteer from 'puppeteer';
|
||||
Puppeteer launches Chromium in
|
||||
[headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome).
|
||||
To launch a full version of Chromium, set the
|
||||
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless)
|
||||
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions)
|
||||
option when launching a browser:
|
||||
|
||||
```ts
|
||||
|
@ -3,8 +3,10 @@ import Head from '@docusaurus/Head';
|
||||
import Link from '@docusaurus/Link';
|
||||
import {useHistory} from '@docusaurus/router';
|
||||
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
||||
import {useContextualSearchFilters} from '@docusaurus/theme-common';
|
||||
import {useSearchPage} from '@docusaurus/theme-common/internal';
|
||||
import {
|
||||
useContextualSearchFilters,
|
||||
useSearchLinkCreator,
|
||||
} from '@docusaurus/theme-common';
|
||||
import Translate from '@docusaurus/Translate';
|
||||
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
@ -19,9 +21,9 @@ function Hit({hit, children}) {
|
||||
return <Link to={hit.url}>{children}</Link>;
|
||||
}
|
||||
function ResultsFooter({state, onClose}) {
|
||||
const {generateSearchPageLink} = useSearchPage();
|
||||
const createSearchLink = useSearchLinkCreator();
|
||||
return (
|
||||
<Link to={generateSearchPageLink(state.query)} onClick={onClose}>
|
||||
<Link to={createSearchLink(state.query)} onClick={onClose}>
|
||||
<Translate
|
||||
id="theme.SearchBar.seeAll"
|
||||
values={{count: state.context.nbHits}}
|
||||
|
@ -7,11 +7,9 @@ import {
|
||||
usePluralForm,
|
||||
isRegexpStringMatch,
|
||||
useEvent,
|
||||
useSearchQueryString,
|
||||
} from '@docusaurus/theme-common';
|
||||
import {
|
||||
useTitleFormatter,
|
||||
useSearchPage,
|
||||
} from '@docusaurus/theme-common/internal';
|
||||
import {useTitleFormatter} from '@docusaurus/theme-common/internal';
|
||||
import Translate, {translate} from '@docusaurus/Translate';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
@ -128,7 +126,7 @@ function SearchPageContent() {
|
||||
} = themeConfig;
|
||||
const documentsFoundPlural = useDocumentsFoundPlural();
|
||||
const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
|
||||
const {searchQuery, setSearchQuery} = useSearchPage();
|
||||
const [searchQuery, setSearchQuery] = useSearchQueryString();
|
||||
const initialSearchResultState = {
|
||||
items: [],
|
||||
query: null,
|
||||
|
Loading…
Reference in New Issue
Block a user