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KAAK,CAAC,QAAQ,CAAC,CAAC;OACtC;AACD,aAAO,IAAI,CAAC,aAAa,CAAC;KAC3B;;;;;;WAKiB,OAAO;;;;WAEP,MAAM;;;;WACN,QAAQ;;;;WACR,KAAK,CAAC,OAAO;;;;WACb,KAAK,CAAC,OAAO;;;;WACb,KAAK,CAAC,QAAQ;;;;;;;;WAMd,gBAAgB;;;;;;;;;WAMnB,IAAI;;;;;;WAGH,KAAK;;;;;;WAGP,IAAI;;;;;;;WAIC,KAAK;;;;;;;WAIF,SAAS;;;;;;sEAG6C,OAAO;;;;;;WAGjE,OAAO;;;;;;WAGH,IAAI;;;;;;WAGN,IAAI;;;;;;;;WAMR,KAAK,CAAC,QAAQ,CAAC;;;;;;WAGR,IAAI;;;;;;WAGN,EAAE;;;;SAxyCnB,OAAO;GAAS,YAAY;;AA4yClC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["require('jsdom'); // work-around for node.js import of jsdom Windows.js before jsdom living module\n\nconst assert = require('assert');\nconst Assert = require('./assert');\nconst Bluebird = require('bluebird');\nconst Tabs = require('./tabs');\nconst Console = require('./console');\nconst Cookies = require('./cookies');\nconst debug = require('debug');\nconst DOM = require('./dom');\nconst { EventEmitter } = require('events');\nconst EventLoop = require('./eventloop');\nconst { format } = require('util');\nconst Fetch = require('./fetch');\nconst File = require('fs');\nconst Mime = require('mime');\nconst ms = require('ms');\nconst Path = require('path');\nconst Pipeline = require('./pipeline');\nconst reroute = require('./reroute');\nconst Storages = require('./storage');\nconst Tough = require('tough-cookie');\nconst { Cookie } = Tough;\nconst URL = require('url');\nconst Utils = require('jsdom/lib/jsdom/utils');\nconst fileListSymbols = require('jsdom/lib/jsdom/living/filelist-symbols');\n\n\n// Version number. We get this from package.json.\nconst VERSION = require(`${__dirname}/../package.json`).version;\n\n// Browser options you can set when creating new browser, or on browser instance.\nconst BROWSER_OPTIONS = ['features', 'headers', 'waitDuration',\n 'proxy', 'referrer', 'silent', 'site', 'strictSSL', 'userAgent',\n 'language', 'runScripts', 'localAddress'];\n\n// These features are set on/off by default.\n// Note that default values are actually prescribed where they are used,\n// by calling hasFeature with name and default\nconst DEFAULT_FEATURES = 'scripts no-css no-img iframe';\n\nconst MOUSE_EVENT_NAMES = ['mousedown', 'mousemove', 'mouseup'];\n\n\n// Use the browser to open up new windows and load documents.\n//\n// The browser maintains state for cookies and local storage.\nclass Browser extends EventEmitter {\n\n constructor(options = {}) {\n super();\n // Used for assertions\n this.assert = new Assert(this);\n this.cookies = new Cookies();\n // Shared by all windows.\n this.console = new Console(this);\n // Start with no this referrer.\n this.referrer = null;\n // Open tabs.\n this.tabs = new Tabs(this);\n // New pipeline for this browser.\n this.pipeline = new Pipeline(this);\n\n // The browser event loop.\n this._eventLoop = new EventLoop(this);\n\n // Returns all errors reported while loading this window.\n this.errors = [];\n\n this._storages = new Storages();\n\n // The window that is currently in scope, some JS functions need this, e.g.\n // when closing a window, you need to determine whether caller (window in\n // scope) is same as window.opener\n this._windowInScope = null;\n\n this._debug = Browser._debug;\n\n // Message written to window.console. Level is log, info, error, etc.\n //\n // All output goes to stdout, except when browser.silent = true and output\n // only shown when debugging (DEBUG=zombie).\n this\n .on('console', (level, message)=> {\n if (this.silent)\n this._debug(`>> ${message}`);\n else\n console.log(message);\n })\n .on('log', (...args)=> {\n // Message written to browser.log.\n this._debug(format(...args));\n });\n\n // Logging resources\n this\n .on('request', (request)=> request)\n .on('response', (request, response)=> {\n this._debug('%s %s => %s', request.method, response.url, response.status);\n })\n .on('redirect', (request, response)=> {\n this._debug('%s %s => %s %s', request.method, request.url, response.status, response.headers.get('Location'));\n })\n .on('loaded', (document)=> {\n this._debug('Loaded document %s', document.location.href);\n })\n .on('xhr', (eventName, url)=> {\n this._debug('XHR %s %s', eventName, url);\n });\n\n // Logging windows/tabs/navigation\n this\n .on('opened', (window)=> {\n this._debug('Opened window %s %s', window.location.href, window.name || '');\n })\n .on('closed', (window)=> {\n this._debug('Closed window %s %s', window.location.href, window.name || '');\n });\n\n // Switching tabs/windows fires blur/focus event on active window/element\n this\n .on('active', (window)=> {\n // Window becomes inactive\n const winFocus = window.document.createEvent('HTMLEvents');\n winFocus.initEvent('focus', false, false);\n window.dispatchEvent(winFocus);\n\n if (window.document.activeElement) {\n const elemFocus = window.document.createEvent('HTMLEvents');\n elemFocus.initEvent('focus', false, false);\n window.document.activeElement.dispatchEvent(elemFocus);\n }\n })\n .on('inactive', (window)=> {\n // Window becomes inactive\n if (window.document.activeElement) {\n const elemBlur = window.document.createEvent('HTMLEvents');\n elemBlur.initEvent('blur', false, false);\n window.document.activeElement.dispatchEvent(elemBlur);\n }\n const winBlur = window.document.createEvent('HTMLEvents');\n winBlur.initEvent('blur', false, false);\n window.dispatchEvent(winBlur);\n });\n\n // Logging navigation\n this\n .on('link', (url)=> {\n this._debug('Follow link to %s', url);\n })\n .on('submit', (url)=> {\n this._debug('Submit form to %s', url);\n });\n\n // Logging event loop\n this._eventLoop\n .on('setTimeout', (fn, delay)=> {\n this._debug('Fired setTimeout after %dms delay', delay);\n this.emit('setTimeout', fn, delay);\n })\n .on('setInterval', (fn, interval)=> {\n this._debug('Fired setInterval every %dms', interval);\n this.emit('setInterval', fn, interval);\n })\n .on('serverEvent', ()=> {\n this._debug('Server initiated event');\n this.emit('serverEvent');\n })\n .on('idle', (timedOut)=> {\n if (timedOut)\n this._debug('Event loop timed out');\n else\n this._debug('Event loop is empty');\n this.emit('idle');\n })\n .on('error', (error)=> {\n this.emit('error', error);\n });\n\n // Make sure we don't blow up Node when we get a JS error, but dump error to console. Also, catch any errors\n // reported while processing resources/JavaScript.\n this.on('error', (error)=> {\n this.errors.push(error);\n this._debug(error.stack);\n });\n\n // Sets the browser options.\n options = options || {};\n for (let name of BROWSER_OPTIONS) {\n this[name] = options.hasOwnProperty(name) ?\n options[name] :\n (Browser[name] || null);\n }\n\n // Last, run all extensions in order.\n for (let extension of Browser._extensions)\n extension(this);\n }\n\n\n // Returns true if the given feature is enabled.\n //\n // If the feature is listed, then it is enabled. If the feature is listed\n // with \"no-\" prefix, then it is disabled. If the feature is missing, return\n // the default value.\n hasFeature(name, defaultValue = true) {\n const features = (this.features || '').split(/\\s+/);\n return ~features.indexOf(name) ? true :\n ~features.indexOf(`no-${name}`) ? false :\n defaultValue;\n }\n\n\n // Return a new browser with a snapshot of this browser's state.\n // Any changes to the forked browser's state do not affect this browser.\n fork() {\n throw new Error('Not implemented');\n }\n\n\n // Windows\n // -------\n\n // Returns the currently open window\n get window() {\n return this.tabs.current;\n }\n\n // Open new browser window.\n open({ url, name, referrer } = {}) {\n return this.tabs.open({ url, name, referrer });\n }\n\n // browser.error => Error\n //\n // Returns the last error reported while loading this window.\n get error() {\n return this.errors[this.errors.length - 1];\n }\n\n\n // Events\n // ------\n\n // Waits for the browser to complete loading resources and processing JavaScript events.\n //\n // Accepts two parameters, both optional:\n // options - Options that determine how long to wait (see below)\n // callback - Called with error or null and browser\n //\n // To determine how long to wait:\n // duration - Do not wait more than this duration (milliseconds or string of\n // the form \"5s\"). Defaults to \"5s\" (see Browser.waitDuration).\n // element - Stop when this element(s) appear in the DOM.\n // function - Stop when function returns true; this function is called with\n // the active window and expected time to the next event (0 to\n // Infinity).\n //\n // As a convenience you can also pass the duration directly.\n //\n // Without a callback, this method returns a promise.\n wait(options, callback) {\n assert(this.window, new Error('No window open'));\n if (arguments.length === 1 && typeof options === 'function')\n [callback, options] = [options, null];\n assert(!callback || typeof callback === 'function', 'Second argument expected to be a callback function or null');\n\n // Support all sort of shortcuts for options. Unofficial.\n const duration =\n (typeof options === 'number') ? options :\n (typeof options === 'string') ? options :\n (options && options.duration || this.waitDuration || '5s');\n // Support 500 (ms) as well as \"5s\"\n const waitDuration = ms(duration.toString());\n\n function completionFromElement(element) {\n return function(window) {\n return !!window.document.querySelector(element);\n };\n }\n\n const completionFunction =\n (typeof options === 'function') ? options :\n (options && options.element) ? completionFromElement(options.element) :\n (options && options.function);\n\n const { _eventLoop } = this;\n if (callback)\n _eventLoop.wait(waitDuration, completionFunction, callback);\n else\n return Bluebird.promisify(_eventLoop.wait.bind(_eventLoop))(waitDuration, completionFunction);\n }\n\n\n // Waits for the browser to get a single event from any EventSource,\n // then completes loading resources and processing JavaScript events.\n //\n // Accepts an optional callback which is called with error or nothing\n //\n // Without a callback, this method returns a promise.\n waitForServer(options, callback) {\n assert(this.window, new Error('No window open'));\n if (arguments.length === 1 && typeof options === 'function')\n [callback, options] = [options, null];\n\n if (callback) {\n this._eventLoop.once('serverEvent', ()=> {\n this.wait(options, callback);\n });\n return null;\n }\n\n return new Promise((resolve)=> {\n this._eventLoop.once('serverEvent', ()=> {\n resolve(this.wait(options, null));\n });\n });\n }\n\n\n // Various methods use this with a callback, or return a lazy promise (e.g.\n // visit, click, fire)\n _wait(options, callback) {\n if (callback) {\n this.wait(options, callback);\n return null;\n }\n\n let promise = null;\n const lazyResolve = ()=> {\n if (!promise)\n promise = this.wait(options, null);\n return promise;\n };\n // Returns equivalent of a promise that only starts evaluating when you\n // call then() or catch() on it.\n return {\n then(resolved, rejected) {\n return lazyResolve().then(resolved, rejected);\n },\n catch(rejected) {\n return lazyResolve().then(null, rejected);\n }\n };\n }\n\n\n // Fire a DOM event. You can use this to simulate a DOM event, e.g. clicking\n // a link. These events will bubble up and can be cancelled. Like `wait`\n // this method takes an optional callback and returns a promise.\n //\n // name - Even name (e.g `click`)\n // target - Target element (e.g a link)\n // callback - Called with error or nothing\n //\n // If called without callback, returns a promise\n fire(selector, eventName, callback) {\n assert(this.window, 'No window open');\n const target = this.query(selector);\n assert(target && target.dispatchEvent, 'No target element (note: call with selector/element, event name and callback)');\n\n const eventType = ~MOUSE_EVENT_NAMES.indexOf(eventName) ? 'MouseEvents' : 'HTMLEvents';\n const event = this.document.createEvent(eventType);\n event.initEvent(eventName, true, true);\n target.dispatchEvent(event);\n return this._wait(null, callback);\n }\n\n // Click on the element and returns a promise.\n //\n // selector - Element or CSS selector\n // callback - Called with error or nothing\n //\n // If called without callback, returns a promise\n click(selector, callback) {\n return this.fire(selector, 'click', callback);\n }\n\n // Dispatch asynchronously. Returns true if preventDefault was set.\n dispatchEvent(selector, event) {\n assert(this.window, 'No window open');\n const target = this.query(selector);\n return target.dispatchEvent(event);\n }\n\n\n // Accessors\n // ---------\n\n // browser.queryAll(selector, context?) => Array\n //\n // Evaluates the CSS selector against the document (or context node) and return array of nodes.\n // (Unlike `document.querySelectorAll` that returns a node list).\n queryAll(selector = 'html', context = this.document) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n\n if (Array.isArray(selector))\n return selector;\n if (selector instanceof DOM.Element)\n return [selector];\n if (selector) {\n const elements = context.querySelectorAll(selector);\n return Array.from(elements);\n } else\n return [];\n }\n\n // browser.query(selector, context?) => Element\n //\n // Evaluates the CSS selector against the document (or context node) and return an element.\n query(selector = 'html', context = this.document) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n\n if (selector instanceof DOM.Element)\n return selector;\n return selector ? context.querySelector(selector) : context;\n }\n\n // WebKit offers this.\n $$(selector, context) {\n return this.query(selector, context);\n }\n\n // browser.querySelector(selector) => Element\n //\n // Select a single element (first match) and return it.\n //\n // selector - CSS selector\n //\n // Returns an Element or null\n querySelector(selector) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n return this.document.querySelector(selector);\n }\n\n // browser.querySelectorAll(selector) => NodeList\n //\n // Select multiple elements and return a static node list.\n //\n // selector - CSS selector\n //\n // Returns a NodeList or null\n querySelectorAll(selector) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n return this.document.querySelectorAll(selector);\n }\n\n // browser.text(selector, context?) => String\n //\n // Returns the text contents of the selected elements.\n //\n // selector - CSS selector (if missing, entire document)\n // context - Context element (if missing, uses document)\n //\n // Returns a string\n text(selector = 'html', context = this.document) {\n assert(this.document, 'No window open');\n\n if (this.document.documentElement)\n return this.queryAll(selector, context)\n .map(elem => elem.textContent)\n .join('')\n .trim()\n .replace(/\\s+/g, ' ');\n else\n return (this.source ? this.source.toString : '');\n }\n\n\n // browser.html(selector?, context?) => String\n //\n // Returns the HTML contents of the selected elements.\n //\n // selector - CSS selector (if missing, entire document)\n // context - Context element (if missing, uses document)\n //\n // Returns a string\n html(selector = 'html', context = this.document) {\n assert(this.document, 'No window open');\n\n if (this.document.documentElement)\n return this.queryAll(selector, context)\n .map(elem => elem.outerHTML.trim())\n .join('');\n else\n return (this.source ? this.source.toString : '');\n }\n\n\n // browser.xpath(expression, context?) => XPathResult\n //\n // Evaluates the XPath expression against the document (or context node) and return the XPath result. Shortcut for\n // `document.evaluate`.\n xpath(expression, context = null) {\n return this.document.evaluate(expression, context || this.document.documentElement, null, DOM.XPathResult.ANY_TYPE);\n }\n\n // browser.document => Document\n //\n // Returns the main window's document. Only valid after opening a document (see `browser.open`).\n get document() {\n return this.window && this.window.document;\n }\n\n // browser.body => Element\n //\n // Returns the body Element of the current document.\n get body() {\n return this.querySelector('body');\n }\n\n // Element that has the current focus.\n get activeElement() {\n return this.document && this.document.activeElement;\n }\n\n // Close all windows, clean state, etc. This doesn't do anything the garbage\n // collector doesn't already do, so you don't need to call this.\n //\n // But because it destroys the browser state, it's quite useful for detecting\n // weird behavior bugs, e.g. an event loop that keeps running. That's why\n // the test suite uses this method.\n destroy() {\n if (this.tabs) {\n this.tabs.closeAll();\n this.tabs = null;\n }\n }\n\n\n // Navigation\n // ----------\n\n // browser.visit(url, callback?)\n //\n // Loads document from the specified URL, processes events and calls the callback, or returns a promise.\n visit(url, options, callback) {\n if (arguments.length < 3 && typeof options === 'function')\n [options, callback] = [{}, options];\n\n const site = /^(https?:|file:)/i.test(this.site) ? this.site : `http://${this.site || 'localhost'}/`;\n url = Utils.resolveHref(site, URL.format(url));\n\n if (this.window)\n this.tabs.close(this.window);\n this.errors = [];\n this.tabs.open({ url: url, referrer: this.referrer });\n return this._wait(options, callback);\n }\n\n\n // browser.load(html, callback)\n //\n // Loads the HTML, processes events and calls the callback.\n //\n // Without a callback, returns a promise.\n load(html, callback) {\n if (this.window)\n this.tabs.close(this.window);\n this.errors = [];\n this.tabs.open({ html: html });\n return this._wait(null, callback);\n }\n\n\n // browser.location => Location\n //\n // Return the location of the current document (same as `window.location`).\n get location() {\n return this.window && this.window.location;\n }\n\n // browser.location = url\n //\n // Changes document location, loads new document if necessary (same as setting `window.location`).\n set location(url) {\n if (this.window)\n this.window.location = url;\n else\n this.open({ url: url });\n }\n\n // browser.url => String\n //\n // Return the URL of the current document (same as `document.URL`).\n get url() {\n return this.window && this.window.location.href;\n }\n\n // browser.link(selector) : Element\n //\n // Finds and returns a link by its text content or selector.\n link(selector) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n // If the link has already been queried, return itself\n if (selector instanceof DOM.Element)\n return selector;\n\n try {\n const link = this.querySelector(selector);\n if (link && link.tagName === 'A')\n return link;\n } catch (error) {\n /* eslint no-empty:0 */\n }\n for (let elem of Array.from(this.querySelectorAll('body a'))) {\n if (elem.textContent.trim() === selector)\n return elem;\n }\n return null;\n }\n\n // browser.clickLink(selector, callback)\n //\n // Clicks on a link. Clicking on a link can trigger other events, load new page, etc: use a callback to be notified of\n // completion. Finds link by text content or selector.\n //\n // selector - CSS selector or link text\n // callback - Called with two arguments: error and browser\n clickLink(selector, callback) {\n const link = this.link(selector);\n assert(link, `No link matching '${selector}'`);\n return this.click(link, callback);\n }\n\n // Return the history object.\n get history() {\n if (!this.window)\n this.open();\n return this.window.history;\n }\n\n // Navigate back in history.\n back(callback) {\n this.window.history.back();\n return this._wait(null, callback);\n }\n\n // Reloads current page.\n reload(callback) {\n this.window.location.reload();\n return this._wait(null, callback);\n }\n\n\n // browser.saveHistory() => String\n //\n // Save history to a text string. You can use this to load the data later on using `browser.loadHistory`.\n saveHistory() {\n return this.window.history.save();\n }\n\n // browser.loadHistory(String)\n //\n // Load history from a text string (e.g. previously created using `browser.saveHistory`.\n loadHistory(serialized) {\n this.window.history.load(serialized);\n }\n\n\n // Forms\n // -----\n\n // browser.field(selector) : Element\n //\n // Find and return an input field (`INPUT`, `TEXTAREA` or `SELECT`) based on a CSS selector, field name (its `name`\n // attribute) or the text value of a label associated with that field (case sensitive, but ignores leading/trailing\n // spaces).\n field(selector) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n // If the field has already been queried, return itself\n if (selector instanceof DOM.Element)\n return selector;\n\n try {\n // Try more specific selector first.\n const field = this.query(selector);\n if (field && (field.tagName === 'INPUT' || field.tagName === 'TEXTAREA' || field.tagName === 'SELECT'))\n return field;\n } catch (error) {\n // Invalid selector, but may be valid field name\n }\n\n // Use field name (case sensitive).\n for (let elem of this.queryAll('input[name],textarea[name],select[name]')) {\n if (elem.getAttribute('name') === selector)\n return elem;\n }\n\n // Try finding field from label.\n for (let label of this.queryAll('label')) {\n if (label.textContent.trim() === selector) {\n // nLabel can either reference field or enclose it\n const forAttr = label.getAttribute('for');\n return forAttr ?\n this.document.getElementById(forAttr) :\n label.querySelector('input,textarea,select');\n }\n }\n return null;\n }\n\n\n // browser.focus(selector) : Element\n //\n // Turns focus to the selected input field. Shortcut for calling `field(selector).focus()`.\n focus(selector) {\n const field = this.field(selector) || this.query(selector);\n assert(field, `No form field matching '${selector}'`);\n field.focus();\n return this;\n }\n\n\n // browser.fill(selector, value) => this\n //\n // Fill in a field: input field or text area.\n //\n // selector - CSS selector, field name or text of the field label\n // value - Field value\n //\n // Returns this.\n fill(selector, value) {\n const field = this.field(selector);\n assert(field && (field.tagName === 'TEXTAREA' || (field.tagName === 'INPUT')), `No INPUT matching '${selector}'`);\n assert(!field.disabled, 'This INPUT field is disabled');\n assert(!field.readonly, 'This INPUT field is readonly');\n\n // Switch focus to field, change value and emit the input event (HTML5)\n field.focus();\n\n // `field.value = value` does not work if there is a custom property descriptor, e.g. in React\n // TODO: check what the actual spec compliant way of doing this is\n const descriptor = Object.getOwnPropertyDescriptor(field.constructor.prototype, 'value');\n descriptor.set.call(field, value);\n\n this.fire(field, 'input', false);\n // Switch focus out of field, if value changed, this will emit change event\n field.blur();\n return this;\n }\n\n _setCheckbox(selector, value) {\n const field = this.field(selector);\n assert(field && field.tagName === 'INPUT' && field.type === 'checkbox', `No checkbox INPUT matching '${selector}'`);\n assert(!field.disabled, 'This INPUT field is disabled');\n assert(!field.readonly, 'This INPUT field is readonly');\n\n if (field.checked ^ value)\n field.click();\n return this;\n }\n\n // browser.check(selector) => this\n //\n // Checks a checkbox.\n //\n // selector - CSS selector, field name or text of the field label\n //\n // Returns this.\n check(selector) {\n return this._setCheckbox(selector, true);\n }\n\n // browser.uncheck(selector) => this\n //\n // Unchecks a checkbox.\n //\n // selector - CSS selector, field name or text of the field label\n //\n // Returns this.\n uncheck(selector) {\n return this._setCheckbox(selector, false);\n }\n\n // browser.choose(selector) => this\n //\n // Selects a radio box option.\n //\n // selector - CSS selector, field value or text of the field label\n //\n // Returns this.\n choose(selector) {\n const field = this.field(selector) || this.field(`input[type=radio][value=\\'${escape(selector)}\\']`);\n assert(field && field.tagName === 'INPUT' && field.type === 'radio', `No radio INPUT matching '${selector}'`);\n\n field.click();\n return this;\n }\n\n _findOption(selector, value) {\n const field = this.field(selector);\n assert(field && field.tagName === 'SELECT', `No SELECT matching '${selector}'`);\n assert(!field.disabled, 'This SELECT field is disabled');\n assert(!field.readonly, 'This SELECT field is readonly');\n\n const options = Array.from(field.options);\n for (let option of options) {\n if (option.value === value)\n return option;\n }\n for (let option of options) {\n if (option.label === value)\n return option;\n }\n for (let option of options) {\n if (option.textContent.trim() === value)\n return option;\n }\n throw new Error(`No OPTION '${value}'`);\n }\n\n // browser.select(selector, value) => this\n //\n // Selects an option.\n //\n // selector - CSS selector, field name or text of the field label\n // value - Value (or label) or option to select\n //\n // Returns this.\n select(selector, value) {\n const option = this._findOption(selector, value);\n this.selectOption(option);\n return this;\n }\n\n // browser.selectOption(option) => this\n //\n // Selects an option.\n //\n // option - option to select\n //\n // Returns this.\n selectOption(selector) {\n const option = this.query(selector);\n if (option && !option.selected) {\n const select = this.xpath('./ancestor::select', option).iterateNext();\n option.selected = true;\n select.focus();\n this.fire(select, 'change', false);\n }\n return this;\n }\n\n // browser.unselect(selector, value) => this\n //\n // Unselects an option.\n //\n // selector - CSS selector, field name or text of the field label\n // value - Value (or label) or option to unselect\n //\n // Returns this.\n unselect(selector, value) {\n const option = this._findOption(selector, value);\n this.unselectOption(option);\n return this;\n }\n\n // browser.unselectOption(option) => this\n //\n // Unselects an option.\n //\n // selector - selector or option to unselect\n //\n // Returns this.\n unselectOption(selector) {\n const option = this.query(selector);\n if (option && option.selected) {\n const select = this.xpath('./ancestor::select', option).iterateNext();\n assert(select.multiple, 'Cannot unselect in single select');\n option.selected = false;\n select.focus();\n this.fire(select, 'change', false);\n }\n return this;\n }\n\n // browser.attach(selector, filename) => this\n //\n // Attaches a file to the specified input field. The second argument is the file name.\n //\n // Returns this.\n attach(selector, filename) {\n const field = this.field(selector);\n assert(field && field.tagName === 'INPUT' && field.type === 'file', `No file INPUT matching '${selector}'`);\n\n if (filename) {\n const stat = File.statSync(filename);\n const file = new (this.window.File)();\n file.name = Path.basename(filename);\n file.type = Mime.lookup(filename);\n file.size = stat.size;\n\n field.value = filename;\n const oldFiles = field.files;\n if (typeof(oldFiles) !== 'array') {\n // JSDOM does not support an API to mock a list of files, and the default\n // type of the 'files' attribute is a FileList object.\n Object.defineProperty(field, 'files', {\n value: []\n });\n }\n field.files.push(file);\n }\n field.focus();\n this.fire(field, 'change', false);\n return this;\n }\n\n // browser.button(selector) : Element\n //\n // Finds a button using CSS selector, button name or button text (`BUTTON` or `INPUT` element).\n //\n // selector - CSS selector, button name or text of BUTTON element\n button(selector) {\n assert(this.document && this.document.documentElement, 'No open window with an HTML document');\n // If the button has already been queried, return itself\n if (selector instanceof DOM.Element)\n return selector;\n\n try {\n const button = this.querySelector(selector);\n if (button && (button.tagName === 'BUTTON' || button.tagName === 'INPUT'))\n return button;\n } catch (error) {\n }\n for (let elem of Array.from(this.querySelectorAll('button'))) {\n if (elem.textContent.trim() === selector)\n return elem;\n }\n\n const inputs = Array.from(this.querySelectorAll('input[type=submit],input[type=button],input[type=reset],button'));\n for (let input of inputs) {\n if (input.name === selector)\n return input;\n }\n for (let input of inputs) {\n if (input.value === selector)\n return input;\n }\n return null;\n }\n\n // browser.pressButton(selector, callback)\n //\n // Press a button (button element or input of type `submit`). Typically this will submit the form. Use the callback\n // to wait for the from submission, page to load and all events run their course.\n //\n // selector - CSS selector, button name or text of BUTTON element\n // callback - Called with two arguments: null and browser\n pressButton(selector, callback) {\n const button = this.button(selector);\n assert(button, `No BUTTON '${selector}'`);\n assert(!button.disabled, 'This button is disabled');\n button.focus();\n return this.fire(button, 'click', callback);\n }\n\n\n // -- Cookies --\n\n\n // Returns cookie that best matches the identifier.\n //\n // identifier - Identifies which cookie to return\n // allProperties - If true, return all cookie properties, other just the value\n //\n // Identifier is either the cookie name, in which case the cookie domain is\n // determined from the currently open Web page, and the cookie path is \"/\".\n //\n // Or the identifier can be an object specifying:\n // name - The cookie name\n // domain - The cookie domain (defaults to hostname of currently open page)\n // path - The cookie path (defaults to \"/\")\n //\n // Returns cookie value, or cookie object (see setCookie).\n getCookie(identifier, allProperties) {\n identifier = this._cookieIdentifier(identifier);\n assert(identifier.name, 'Missing cookie name');\n assert(identifier.domain, 'No domain specified and no open page');\n\n const cookie = this.cookies.select(identifier)[0];\n return cookie ?\n (allProperties ?\n this._cookieProperties(cookie) :\n cookie.value) :\n null;\n }\n\n // Deletes cookie that best matches the identifier.\n //\n // identifier - Identifies which cookie to return\n //\n // Identifier is either the cookie name, in which case the cookie domain is\n // determined from the currently open Web page, and the cookie path is \"/\".\n //\n // Or the identifier can be an object specifying:\n // name - The cookie name\n // domain - The cookie domain (defaults to hostname of currently open page)\n // path - The cookie path (defaults to \"/\")\n //\n // Returns true if cookie delete.\n deleteCookie(identifier) {\n identifier = this._cookieIdentifier(identifier);\n assert(identifier.name, 'Missing cookie name');\n assert(identifier.domain, 'No domain specified and no open page');\n\n const cookie = this.cookies.select(identifier)[0];\n if (cookie)\n this.cookies.delete(cookie);\n return !!cookie;\n }\n\n // Sets a cookie.\n //\n // You can call this function with two arguments to set a session cookie: the\n // cookie value and cookie name. The domain is determined from the current\n // page URL, and the path is always \"/\".\n //\n // Or you can call it with a single argument, with all cookie options:\n // name - Name of the cookie\n // value - Value of the cookie\n // domain - The cookie domain (e.g example.com, .example.com)\n // path - The cookie path\n // expires - Time when cookie expires\n // maxAge - How long before cookie expires\n // secure - True for HTTPS only cookie\n // httpOnly - True if cookie not accessible from JS\n setCookie(nameOrOptions, value) {\n const domain = this.location && this.location.hostname;\n if (typeof nameOrOptions === 'string')\n this.cookies.set({\n name: nameOrOptions,\n value: value || '',\n domain: domain,\n path: '/',\n secure: false,\n httpOnly: false\n });\n else {\n assert(nameOrOptions.name, 'Missing cookie name');\n this.cookies.set({\n name: nameOrOptions.name,\n value: nameOrOptions.value || value || '',\n domain: nameOrOptions.domain || domain,\n path: nameOrOptions.path || '/',\n secure: !!nameOrOptions.secure,\n httpOnly: !!nameOrOptions.httpOnly,\n expires: nameOrOptions.expires,\n 'max-age': nameOrOptions['max-age']\n });\n }\n }\n\n // Deletes all cookies.\n deleteCookies() {\n this.cookies.deleteAll();\n }\n\n // Save cookies to a text string. You can use this to load them back\n // later on using `Browser.loadCookies`.\n saveCookies() {\n const serialized = [`# Saved on ${new Date().toISOString()}`];\n for (let cookie of this.cookies.sort(Tough.cookieCompare))\n serialized.push(cookie.toString());\n return serialized.join('\\n') + '\\n';\n }\n\n // Load cookies from a text string (e.g. previously created using\n // `Browser.saveCookies`.\n loadCookies(serialized) {\n for (let line of serialized.split(/\\n+/)) {\n line = line.trim();\n if (line && line[0] !== `#`)\n this.cookies.push(Cookie.parse(line));\n }\n }\n\n // Converts Tough Cookie object into Zombie cookie representation.\n _cookieProperties(cookie) {\n const properties = {\n name: cookie.key,\n value: cookie.value,\n domain: cookie.domain,\n path: cookie.path\n };\n if (cookie.secure)\n properties.secure = true;\n if (cookie.httpOnly)\n properties.httpOnly = true;\n if (cookie.expires && cookie.expires < Infinity)\n properties.expires = cookie.expires;\n return properties;\n }\n\n // Converts cookie name/identifier into an identifier object.\n _cookieIdentifier(identifier) {\n const location = this.location;\n const domain = location && location.hostname;\n const path = location && location.pathname || '/';\n return {\n name: identifier.name || identifier,\n domain: identifier.domain || domain,\n path: identifier.path || path\n };\n }\n\n\n // -- Local/Session Storage --\n\n\n // Returns local Storage based on the document origin (hostname/port). This is the same storage area you can access\n // from any document of that origin.\n localStorage(host) {\n return this._storages.local(host);\n }\n\n // Returns session Storage based on the document origin (hostname/port). This is the same storage area you can access\n // from any document of that origin.\n sessionStorage(host) {\n return this._storages.session(host);\n }\n\n // Save local/session storage to a text string. You can use this to load the data later on using\n // `browser.loadStorage`.\n saveStorage() {\n return this._storages.save();\n }\n\n // Load local/session storage from a text string (e.g. previously created using `browser.saveStorage`.\n loadStorage(serialized) {\n this._storages.load(serialized);\n }\n\n\n // Scripts\n // -------\n\n // Evaluates a JavaScript expression in the context of the current window and returns the result. When evaluating\n // external script, also include filename.\n //\n // You can also use this to evaluate a function in the context of the window: for timers and asynchronous callbacks\n // (e.g. XHR).\n evaluate(code, filename) {\n if (!this.window)\n this.open();\n return this.window._evaluate(code, filename);\n }\n\n\n // Resources\n // ---------\n\n fetch(input, init) {\n return this.pipeline._fetch(input, init);\n }\n\n // Returns all resources loaded by currently open window.\n get resources() {\n return this.window && this.window.resources;\n }\n\n // Get Request associated with currently open window\n get request() {\n return this.window && this.window._request || null;\n }\n\n // Get Response associated with currently open window\n get response() {\n return this.window && this.window._response || null;\n }\n\n // Get the status code of the response associated with this window\n get status() {\n const { response } = this;\n return response ? response.status : 0;\n }\n\n get statusCode() {\n return this.status;\n }\n\n // Return true if last response had status code 200 .. 299\n get success() {\n const { status } = this;\n return status >= 200 && status < 300;\n }\n\n // Returns true if the last response followed a redirect\n get redirected() {\n const { request } = this;\n return request ? (request._redirectCount > 0) : false;\n }\n\n // Get the source HTML for the last response\n get source() {\n const { response } = this;\n return response ? response.body : null;\n }\n\n\n // Debugging\n // ---------\n\n // Enable debugging. You can do this in code instead of setting DEBUG environment variable.\n debug() {\n this._debug = Browser._enableDebugging();\n }\n\n\n\n // Zombie can spit out messages to help you figure out what's going on as your code executes.\n //\n // To spit a message to the console when running in debug mode, call this method with one or more values (same as\n // `console.log`). You can also call it with a function that will be evaluated only when running in debug mode.\n //\n // For example:\n // browser.log('Opening page:', url);\n // browser.log(function() { return 'Opening page: ' + url });\n log(...args) {\n if (typeof args[0] === 'function')\n args = [args[0]()];\n this.emit('log', format(...args));\n }\n\n // Dump information to the console: Zombie version, current URL, history, cookies, event loop, etc. Useful for\n // debugging and submitting error reports.\n dump(output = process.stdout) {\n function indent(lines) {\n return lines.map(line => ` ${line}\\n`).join('');\n }\n output.write(`Zombie: ${Browser.VERSION}\\n`);\n output.write(`URL: ${this.window.location.href}\\n`);\n output.write(`\\nHistory:\\n`);\n this.history.dump(output);\n output.write(`\\nCookies:\\n`);\n this.cookies.dump(output);\n output.write(`\\nStorage:\\n`);\n\n if (this.document) {\n const html = this.html();\n const slice = (html.length > 497) ? `${html.slice(0, 497)}...` : html;\n output.write(`Document:\\n${indent(slice.split('\\n'))}\\n`);\n } else\n output.write('No document\\n');\n\n output.write('\\n');\n this._eventLoop.dump(output);\n }\n\n\n // -- Static methods ---\n\n // ### zombie.visit(url, callback)\n // ### zombie.visit(url, options? callback)\n //\n // Creates a new Browser, opens window to the URL and calls the callback when\n // done processing all events.\n //\n // * url -- URL of page to open\n // * callback -- Called with error, browser\n static visit(url, options, callback) {\n if (arguments.length === 2 && typeof options === 'function')\n [options, callback] = [null, options];\n const browser = new Browser(options);\n if (callback)\n browser.visit(url, (error)=> callback(error, browser));\n else\n return browser.visit(url).then(()=> browser);\n }\n\n // Allows you to make requests against a named domain and HTTP/S port, and\n // will route it to the test server running on localhost and unprivileged\n // port.\n static localhost(source, target) {\n reroute(source, target);\n if (!this.site) {\n const [ hostname ] = source.split(':');\n this.site = hostname.replace(/^\\*\\./, '');\n }\n }\n\n // Register a browser extension.\n //\n // Browser extensions are called for each newly created browser object, and\n // can be used to change browser options, register listeners, add methods,\n // etc.\n static extend(extension) {\n this._extensions.push(extension);\n }\n\n // Call this to return a debug() instance with debugging enabled.\n static _enableDebugging() {\n // With debugging enabled, every time we call debug('zombie') we get a new\n // instance which outputs with a different color. This can be confusing, so\n // if debugging is already enabled (DEBUG=zombie) we want to use the current\n // instance. Otherwise, we want to create a new instance (_debugEnabled)\n // and reuse it every time someone calls browser.debug().\n if (this._debug.enabled)\n return this._debug.enabled;\n\n if (!this._debugEnabled) {\n debug.enable('zombie');\n this._debugEnabled = debug('zombie');\n }\n return this._debugEnabled;\n }\n\n\n // -- Static properties --\n\n static VERSION = VERSION\n\n static Assert = Assert\n static Pipeline = Pipeline\n static Headers = Fetch.Headers\n static Request = Fetch.Request\n static Response = Fetch.Response\n\n\n // -- These defaults are used in any new browser instance --\n\n // Which features are enabled.\n static features = DEFAULT_FEATURES\n\n // Proxy URL.\n //\n // Example\n // Browser.proxy = 'http://myproxy:8080'\n static proxy = null\n\n // If true, suppress `console.log` output from scripts (ignored when DEBUG=zombie)\n static silent = false\n\n // You can use visit with a path, and it will make a request relative to this host/URL.\n static site = null\n\n // Check SSL certificates against CA. False by default since you're likely\n // testing with a self-signed certificate.\n static strictSSL = false\n\n // Sets the outgoing IP address in case there is more than on available.\n // Defaults to 0.0.0.0 which should select default interface\n static localAddress = '0.0.0.0'\n\n // User agent string sent to server.\n static userAgent = `Mozilla/5.0 Chrome/10.0.613.0 Safari/534.15 Zombie.js/${VERSION}`\n\n // Navigator language code\n static language = 'en-US'\n\n // Default time to wait (visit, wait, etc).\n static waitDuration = '5s'\n\n // Indicates whether or not to validate and execute JavaScript, default true.\n static runScripts = true\n\n\n // -- Internal properties --\n\n // Debug instance. Create new instance when enabling debugging with Zombie.debug\n static _debug = debug('zombie')\n\n // Set after calling _enableDebugging\n static _debugEnabled = null\n\n // Browser extensions;\n static _extensions = []\n}\n\n\nmodule.exports = Browser;\n"]}