Class: Puppeteer::Page::ScriptTag

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(content: nil, path: nil, type: nil, url: nil) ⇒ ScriptTag

Returns a new instance of ScriptTag.

Parameters:



406
407
408
409
410
411
# File 'lib/puppeteer/page.rb', line 406

def initialize(content: nil, path: nil, type: nil, url: nil)
  @content = content
  @path = path
  @type = type
  @url = url
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



412
413
414
# File 'lib/puppeteer/page.rb', line 412

def content
  @content
end

#pathObject (readonly)

Returns the value of attribute path.



412
413
414
# File 'lib/puppeteer/page.rb', line 412

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



412
413
414
# File 'lib/puppeteer/page.rb', line 412

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



412
413
414
# File 'lib/puppeteer/page.rb', line 412

def url
  @url
end