mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(Page): kill the page.plainText method (#994)
The page.plainText is confusing: it's unclear what kind of text it returns, textContent or innerText. It's also easily polyfillable and doesn't seem to be used. BREAKING CHANGE: the page.plainText is not existing any more. Instead, use `page.evaluate(() => document.body.innerText)`.
This commit is contained in:
parent
079db90066
commit
1fbf2a8a46
@ -58,7 +58,6 @@
|
|||||||
+ [page.mainFrame()](#pagemainframe)
|
+ [page.mainFrame()](#pagemainframe)
|
||||||
+ [page.mouse](#pagemouse)
|
+ [page.mouse](#pagemouse)
|
||||||
+ [page.pdf(options)](#pagepdfoptions)
|
+ [page.pdf(options)](#pagepdfoptions)
|
||||||
+ [page.plainText()](#pageplaintext)
|
|
||||||
+ [page.reload(options)](#pagereloadoptions)
|
+ [page.reload(options)](#pagereloadoptions)
|
||||||
+ [page.screenshot([options])](#pagescreenshotoptions)
|
+ [page.screenshot([options])](#pagescreenshotoptions)
|
||||||
+ [page.select(selector, ...values)](#pageselectselector-values)
|
+ [page.select(selector, ...values)](#pageselectselector-values)
|
||||||
@ -764,9 +763,6 @@ The `format` options are:
|
|||||||
- `A4`: 8.27in x 11.7in
|
- `A4`: 8.27in x 11.7in
|
||||||
- `A5`: 5.83in x 8.27in
|
- `A5`: 5.83in x 8.27in
|
||||||
|
|
||||||
#### page.plainText()
|
|
||||||
- returns: <[Promise]<[string]>> Returns page's inner text.
|
|
||||||
|
|
||||||
#### page.reload(options)
|
#### page.reload(options)
|
||||||
- `options` <[Object]> Navigation parameters which might have the following properties:
|
- `options` <[Object]> Navigation parameters which might have the following properties:
|
||||||
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout.
|
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout.
|
||||||
|
@ -664,13 +664,6 @@ class Page extends EventEmitter {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {!Promise<string>}
|
|
||||||
*/
|
|
||||||
async plainText() {
|
|
||||||
return this.evaluate(() => document.body.innerText);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {!Promise<string>}
|
* @return {!Promise<string>}
|
||||||
*/
|
*/
|
||||||
|
@ -2186,13 +2186,6 @@ describe('Page', function() {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.plainText', function() {
|
|
||||||
it('should return the page text', SX(async function(){
|
|
||||||
await page.setContent('<div>the result text</div>');
|
|
||||||
expect(await page.plainText()).toBe('the result text');
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Page.title', function() {
|
describe('Page.title', function() {
|
||||||
it('should return the page title', SX(async function(){
|
it('should return the page title', SX(async function(){
|
||||||
await page.goto(PREFIX + '/input/button.html');
|
await page.goto(PREFIX + '/input/button.html');
|
||||||
|
Loading…
Reference in New Issue
Block a user