Class: Puppeteer::Page::ScriptTag
- Inherits:
-
Object
- Object
- Puppeteer::Page::ScriptTag
- Defined in:
- lib/puppeteer/page.rb
Overview
/**
* @param {Array<Network.CookieParam>} cookies
*/
async setCookie(…cookies)
const pageURL = this.url();
const startsWithHTTP = pageURL.startsWith('http');
const items = cookies.map(cookie => {
const item = Object.assign({, cookie);
if (!item.url && startsWithHTTP)
item.url = pageURL;
assert(item.url !== 'about:blank', `Blank page can not have cookie "$itemitem.name"`);
assert(!String.prototype.startsWith.call(item.url || '', 'data:'), `Data URL page can not have cookie "$itemitem.name"`);
return item;
});
await this.deleteCookie(...items);
if (items.length)
await this._client.send('Network.setCookies', { cookies: items });
}
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(content: nil, path: nil, type: nil, url: nil) ⇒ ScriptTag
constructor
A new instance of ScriptTag.
Constructor Details
#initialize(content: nil, path: nil, type: nil, url: nil) ⇒ ScriptTag
Returns a new instance of ScriptTag.
346 347 348 349 350 351 |
# File 'lib/puppeteer/page.rb', line 346 def initialize(content: nil, path: nil, type: nil, url: nil) @content = content @path = path @type = type @url = url end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
352 353 354 |
# File 'lib/puppeteer/page.rb', line 352 def content @content end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
352 353 354 |
# File 'lib/puppeteer/page.rb', line 352 def path @path end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
352 353 354 |
# File 'lib/puppeteer/page.rb', line 352 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
352 353 354 |
# File 'lib/puppeteer/page.rb', line 352 def url @url end |