Attach a Watir::IE instance to a popup window.

 Typical usage
   new_popup_window(:url => "http://www.google.com/a.pdf")
513290
def new_popup_window(options, browser = "ie")
      if is_firefox?
        raise "not implemented"
      else
        if options[:url]
          Watir::IE.attach(:url, options[:url])
        elsif options[:title]
          Watir::IE.attach(:title, options[:title])
        else
          raise 'Please specify title or url of new pop up window'
        end
      end
    end
1349916
function(url) {
			var self = this;
			var content = '';

			// If no accessible title, set it to 'Dialog Window'
			if ( self.options.accessible_title == null ) {
				self.options.accessible_title = 'Dialog Window'
			}

			if ( self.xhr !== null ){
				self.xhr.abort();
				self.xhr = null;
			}

			self.build_modal('<div class="modaal-content-container' + ( self.options.loading_class != '' ? ' ' + self.options.loading_class : '' ) + '">' + self.options.loading_content + '</div>' );

			self.xhr = $.ajax(url, {
				success: function(data) {
					// content fetch is successful so push it into markup
					var target = $('#' + self.scope.id).find('.modaal-content-container');
					if ( target.length > 0){
						target.removeClass( self.options.loading_class );
						target.html( data );

						self.options.ajax_success.call(self, target);
					}
				},
				error: function( xhr ) {
					// There were some errors so return an error message
					if ( xhr.statusText == 'abort' ){
						return;
					}

					var target = $('#' + self.scope.id + ' .modaal-content-container');
					if ( target.length > 0){
						target.removeClass( self.options.loading_class ).addClass( self.options.ajax_error_class );
						target.html( 'Content could not be loaded. Please check the source and try again.' );
					}
				}
			});
		}
1021282
def openSourceWindow(self, current_class, method=None):
        
        log.debug("openSourceWindow for %s" % current_class)

        sourcewin = self.getMeOpenedWindowIfExists(current_class.current_title + "(S)")
        if not sourcewin:
            current_filename = self.session.get_filename_by_class(current_class)
            current_digest = self.session.get_digest_by_class(current_class)

            sourcewin = SourceWindow(win=self,
                                     current_class=current_class,
                                     current_title=current_class.current_title + "(S)",
                                     current_filename=current_filename,
                                     current_digest=current_digest,
                                     session=self.session)
            sourcewin.reload_java_sources()
            self.central.addTab(sourcewin, sourcewin.title)
            self.central.setTabToolTip(self.central.indexOf(sourcewin),
                                       sourcewin.title)

        if method:
            sourcewin.browse_to_method(method)

        self.central.setCurrentWidget(sourcewin)
283919
def click_link_with_text(link_text, opts = {})
        if opts && opts[:index]
          elements = find_elements(:link_text, link_text)
          elements[opts[:index]-1].click
        else
          find_element(:link_text, link_text).click
        end
      end
649705
def enable_event_listener
      @event_listener ||= lambda do |event|
        self.page = @page ? @page.getEnclosingWindow.getEnclosedPage : event.getNewPage
      end

      listener.add_listener(:web_window_event, &@event_listener)
    end
1051806
function () {

            var iframe, document = Aria.$window.document;

            iframe = document.createElement('iframe');

            iframe.setAttribute('id', this.IFRAME_ID);
            iframe.style.display = 'none';

            document.body.appendChild(iframe);

            this._iframe = iframe;
            this.polledIframeHashString = this._currentHashString;

            this._addIframeHistoryEntry(this._currentHashString);
        }
261659
def link(text, url = nil)
      url = text if url.nil?
      tag(:a, text, href: url)
    end
380848
function(element) {
				var links = element.querySelectorAll("a.xref, a.link, area"),
					i,
					link,
					href,
					startsWithHash,
					startsWithHTTP;

				for (i = 0; i < links.length; i++) {
					link = links[i];
					href = link.getAttribute("href");
					startsWithHash = href.indexOf("#") == 0;
					startsWithHTTP = href.indexOf("http") == 0;

					// absolute links should open in a new window
					if (startsWithHTTP) {
						link.setAttribute('target', '_blank');
					}
					// absolute links and links starting with # are ok and should not be modified
					if (startsWithHTTP || startsWithHash) {
						continue;
					}

					// API reference are recognized by "/docs/api/" string
					if (href.indexOf("/docs/api/") > -1) {
						href = href.substr(0, href.lastIndexOf(".html"));
						href = href.substr(href.lastIndexOf('/') + 1);
						href = "#/api/" + href;
					} else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them
						href = href.split("../").join("");
						href = oConfig.exploredURI + href;
					} else { // we assume all other links are links to other documentation pages
						href = href.substr(0, href.lastIndexOf(".html"));
						href = "#/topic/" + href;
					}

					link.setAttribute("href", href);
				}
			}
105511
def open_new_window(kind = :tab)
      window_opened_by do
        if driver.method(:open_new_window).arity.zero?
          driver.open_new_window
        else
          driver.open_new_window(kind)
        end
      end
    end
118658
def url(self):
        
        with switch_window(self._browser, self.name):
            return self._browser.url
290975
def click_link(self, link_text, timeout=settings.SMALL_TIMEOUT):
        
        self.click_link_text(link_text, timeout=timeout)
1371027
function () {
            // --------------------------------------------------- destructuring

            var cfg = this._cfg;

            var modal = cfg.modal;
            var waiAria = cfg.waiAria;

            // ------------------------------------------------------ processing

            // refreshParams ---------------------------------------------------

            var refreshParams = {
                section : "__dialog_" + this._domId,
                writerCallback : {
                    fn : this._writerCallback,
                    scope : this
                }
            };

            // popupContainer --------------------------------------------------

            var popupContainer = PopupContainerManager.createPopupContainer(cfg.container);
            this._popupContainer = popupContainer;

            // previouslyFocusedElement ----------------------------------------

            if (modal) {
                this._previouslyFocusedElement = Aria.$window.document.activeElement;
            }

            // optionsBeforeMaximize -------------------------------------------
            // store current options to reapply them when unmaximized

            this._optionsBeforeMaximize = this._createOptionsBeforeMaximize(cfg);

            // section ---------------------------------------------------------

            var section = this._context.getRefreshedSection(refreshParams);

            // popup -----------------------------------------------------------

            var popup = new ariaPopupsPopup();

            this._popup = popup;

            popup.$on({
                "onAfterOpen" : this._onAfterPopupOpen,
                "onEscape" : this._onEscape,
                "onAfterClose" : this._onAfterPopupClose,
                scope : this
            });

            if (cfg.closeOnMouseClick) {
                popup.$on({
                    "onMouseClickClose" : this._onMouseClickClose,
                    scope : this
                });
            }

            popup.open({
                section : section,
                keepSection : true,
                absolutePosition : {
                    left : cfg.xpos,
                    top : cfg.ypos
                },
                center : cfg.center,
                maximized : cfg.maximized,
                offset : cfg.maximized ? this._shadows : this._shadowsZero,
                modal : modal,
                maskCssClass : "xDialogMask",
                popupContainer : popupContainer,
                closeOnMouseClick : cfg.closeOnMouseClick,
                closeOnMouseScroll : false,
                parentDialog : this,
                zIndexKeepOpenOrder : false, // allows to re-order dialogs (dynamic z-index)
                role: modal ? "dialog" : null,
                labelId: modal ? this.__getLabelId() : null,
                waiAria: waiAria
            });

            // hiddenElements --------------------------------------------------

            if (modal && waiAria) {
                var container = popupContainer.getContainerElt();
                this._showBack = DomNavigationManager.hidingManager.hideOthers(popup.domElement, function (element) {
                     return element != null && element !== container;
                });
            }

            // -----------------------------------------------------------------

            // must be registered before we check for _cfg.maximized, to fire the event correctly after overflow change
            ariaTemplatesLayout.$on({
                "viewportResized" : this._onViewportResized,
                scope : this
            });

            // -----------------------------------------------------------------

            // in case when bound "maximized" was toggled while Dialog was not visible
            if (cfg.maximized) {
                this._setContainerOverflow("hidden");
                this._setMaximizedHeightAndWidth();
            }

            this._firstEscapeTime = null;
        }
1029378
function createPopup(popupName, options, popupTypeClass, popupContent, popupHover) {

    // Check if popup already exists
    if (popups[popupName])
      return popups[popupName];

    // Create the popup
    var $popup = $(DIV_TAG)
      .hide()
      .addClass(POPUP_CLASS)
      .appendTo("body");

    // Add the content

    // Custom popup
    if (popupContent)
      $popup.html(popupContent);

    // Color
    else if (popupName == "color") {
      var colors = options.colors.split(" ");
      if (colors.length < 10)
        $popup.width("auto");
      $.each(colors, function(idx, color) {
        $(DIV_TAG).appendTo($popup)
          .css(BACKGROUND_COLOR, "#" + color);
      });
      popupTypeClass = COLOR_CLASS;
    }

    // Font
    else if (popupName == "font")
      $.each(options.fonts.split(","), function(idx, font) {
        $(DIV_TAG).appendTo($popup)
          .css("fontFamily", font)
          .html(font);
      });

    // Size
    else if (popupName == "size")
      $.each(options.sizes.split(","), function(idx, size) {
        $(DIV_TAG).appendTo($popup)
          .html("<font size=" + size + ">" + size + "</font>");
      });

    // Style
    else if (popupName == "style")
      $.each(options.styles, function(idx, style) {
        $(DIV_TAG).appendTo($popup)
          .html(style[1] + style[0] + style[1].replace("<", "</"));
      });

    // URL
    else if (popupName == "url") {
      $popup.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');
      popupTypeClass = PROMPT_CLASS;
    }

    // Paste as Text
    else if (popupName == "pastetext") {
      $popup.html('Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>');
      popupTypeClass = PROMPT_CLASS;
    }

    // Add the popup type class name
    if (!popupTypeClass && !popupContent)
      popupTypeClass = LIST_CLASS;
    $popup.addClass(popupTypeClass);

    // Add the unselectable attribute to all items
    if (ie) {
      $popup.attr(UNSELECTABLE, "on")
        .find("div,font,p,h1,h2,h3,h4,h5,h6")
        .attr(UNSELECTABLE, "on");
    }

    // Add the hover effect to all items
    if ($popup.hasClass(LIST_CLASS) || popupHover === true)
      $popup.children().hover(hoverEnter, hoverLeave);

    // Add the popup to the array and return it
    popups[popupName] = $popup[0];
    return $popup[0];

  }
175196
function() {
		var checkReadyInterval,
			url = this._createUrl(),

			/**
			 * Bogus title to prevent re-usage of existing window with the
			 * same title. The actual title will be set by the new window's
			 * GoldenLayout instance if it detects that it is in subWindowMode
			 */
			title = Math.floor( Math.random() * 1000000 ).toString( 36 ),

			/**
			 * The options as used in the window.open string
			 */
			options = this._serializeWindowOptions( {
				width: this._dimensions.width,
				height: this._dimensions.height,
				innerWidth: this._dimensions.width,
				innerHeight: this._dimensions.height,
				menubar: 'no',
				toolbar: 'no',
				location: 'no',
				personalbar: 'no',
				resizable: 'yes',
				scrollbars: 'no',
				status: 'no'
			} );

		this._popoutWindow = window.open( url, title, options );

		if( !this._popoutWindow ) {
			if( this._layoutManager.config.settings.blockedPopoutsThrowError === true ) {
				var error = new Error( 'Popout blocked' );
				error.type = 'popoutBlocked';
				throw error;
			} else {
				return;
			}
		}

		$( this._popoutWindow )
			.on( 'load', lm.utils.fnBind( this._positionWindow, this ) )
			.on( 'unload beforeunload', lm.utils.fnBind( this._onClose, this ) );

		/**
		 * Polling the childwindow to find out if GoldenLayout has been initialised
		 * doesn't seem optimal, but the alternatives - adding a callback to the parent
		 * window or raising an event on the window object - both would introduce knowledge
		 * about the parent to the child window which we'd rather avoid
		 */
		checkReadyInterval = setInterval( lm.utils.fnBind( function() {
			if( this._popoutWindow.__glInstance && this._popoutWindow.__glInstance.isInitialised ) {
				this._onInitialised();
				clearInterval( checkReadyInterval );
			}
		}, this ), 10 );
	}
926971
function openBrowser (url) {
  // Attempt to honor this environment variable.
  // It is specific to the operating system.
  // See https://github.com/sindresorhus/opn#app for documentation.
  const browser = process.env.BROWSER;

  // Special case: BROWSER="none" will prevent opening completely.
  if (browser === 'none') return false;

  // If we're on OS X, the user hasn't specifically
  // requested a different browser, we can try opening
  // Chrome with AppleScript. This lets us reuse an
  // existing tab when possible instead of creating a new one.
  const shouldTryOpenChromeWithAppleScript = (
    process.platform === 'darwin' && (
      typeof browser !== 'string' ||
      browser === OSX_CHROME
    )
  );

  if (shouldTryOpenChromeWithAppleScript) {
    try {
      // Try our best to reuse existing tab
      // on OS X Google Chrome with AppleScript
      execSync('ps cax | grep "Google Chrome"');
      execSync(
        'osascript openChrome.applescript ' + url,
        {cwd: __dirname, stdio: 'ignore'}
      );
      return true;
    } catch (err) {
      // Ignore errors.
    }
  }

  // Fallback to opn
  // (It will always open new tab)
  try {
    const options = {app: browser};
    opn(url, options).catch(() => {}); // Prevent `unhandledRejection` error.
    return true;
  } catch (err) {
    return false;
  }
}
895364
function createLink(link) {
        var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK),
            left = link.bbox[0],
            top = link.bbox[1],
            attr = {};

        if (browser.ie) {
            // @NOTE: IE doesn't allow override of ctrl+click on anchor tags,
            // but there is a workaround to add a child element (which triggers
            // the onclick event first)
            $('<span>')
                .appendTo($link)
                .on('click', handleClick);
        }

        $link.css({
            left: left + 'pt',
            top: top + 'pt',
            width: link.bbox[2] - left + 'pt',
            height: link.bbox[3] - top + 'pt'
        });

        if (link.uri) {
            if (/^http|^mailto/.test(link.uri)) {
                attr.href = encodeURI(link.uri);
                attr.target = '_blank';
                attr.rel = 'noreferrer'; // strip referrer for privacy
            } else {
                // don't embed this link... we don't trust the protocol
                return;
            }
        } else if (link.destination) {
            attr.href = '#page-' + link.destination.pagenum;
        }

        $link.attr(attr);
        $link.data('link', link);
        $link.appendTo($el);
    }
438305
def follow(link, scope={})
      in_scope(scope) do
        begin
          click_link(link)
        rescue Capybara::ElementNotFound
          raise Kelp::MissingLink,
            "No link with title, id or text '#{link}' found"
        end
      end
    end