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.mouse](#pagemouse)
|
||||
+ [page.pdf(options)](#pagepdfoptions)
|
||||
+ [page.plainText()](#pageplaintext)
|
||||
+ [page.reload(options)](#pagereloadoptions)
|
||||
+ [page.screenshot([options])](#pagescreenshotoptions)
|
||||
+ [page.select(selector, ...values)](#pageselectselector-values)
|
||||
@ -764,9 +763,6 @@ The `format` options are:
|
||||
- `A4`: 8.27in x 11.7in
|
||||
- `A5`: 5.83in x 8.27in
|
||||
|
||||
#### page.plainText()
|
||||
- returns: <[Promise]<[string]>> Returns page's inner text.
|
||||
|
||||
#### page.reload(options)
|
||||
- `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.
|
||||
|
@ -664,13 +664,6 @@ class Page extends EventEmitter {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {!Promise<string>}
|
||||
*/
|
||||
async plainText() {
|
||||
return this.evaluate(() => document.body.innerText);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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() {
|
||||
it('should return the page title', SX(async function(){
|
||||
await page.goto(PREFIX + '/input/button.html');
|
||||
|
Loading…
Reference in New Issue
Block a user