Creates a Watir::Browser instance.

 @param [Symbol, Selenium::WebDriver] browser :firefox, :ie, :chrome, :remote or Selenium::WebDriver instance
 @param args Passed to the underlying driver
168526
def inspect
      if alert.exists?
        format('#<%s:0x%x alert=true>', self.class, hash * 2)
      else
        format('#<%s:0x%x url=%s title=%s>', self.class, hash * 2, url.inspect, title.inspect)
      end
    rescue Errno::ECONNREFUSED
      format('#<%s:0x%x closed=true>', self.class, hash * 2)
    end
1271999
function browser (winOptions) {
    winOptions = assign({ graceful: true }, winOptions)

    // Handle `browser-window` being passed as `parent`.
    if (winOptions.parent && winOptions.parent._native) {
      winOptions.parent = winOptions.parent._native
    }

    if (winOptions.graceful) winOptions.show = false

    // Create `BrowserWindow` backend.
    const window = new BrowserWindow(winOptions)

    if (winOptions.graceful) window.on('ready-to-show', function () { window.show() })

    // Method for loading urls or data.
    function load (source, options, callback = noop) {
      if (typeof options === 'function') callback = options, options = {}
      options = assign({type: null, encoding: 'base64'}, options)

      // Callback handler
      var contents = window.webContents
      eventcb(contents, 'did-finish-load', 'did-fail-load', callback)

      // Load source as data:
      if (options.type) {
        const data = Buffer.from(source).toString(options.encoding)
        return window.loadURL(`data:${options.type};${options.encoding},${data}`, options)
      }

      // Load source as URL:
      const protocol = url.parse(source).protocol
      if (!protocol) source = 'file://' + source
      return window.loadURL(source, options)
    }

    // Send IPC messages
    function send (...args) {
      return window.webContents.send(...args)
    }

    // Create a child window
    function subwindow (options) {
      return browser(assign({ parent: window }, options))
    }

    // Return methods
    return {load, send, subwindow, native: window}
  }
748138
def brozzler_worker(argv=None):
    '''
    
    '''
    argv = argv or sys.argv
    arg_parser = argparse.ArgumentParser(
            prog=os.path.basename(argv[0]),
            formatter_class=BetterArgumentDefaultsHelpFormatter)
    add_rethinkdb_options(arg_parser)
    arg_parser.add_argument(
            '-e', '--chrome-exe', dest='chrome_exe',
            default=suggest_default_chrome_exe(),
            help='executable to use to invoke chrome')
    arg_parser.add_argument(
            '-n', '--max-browsers', dest='max_browsers', default='1',
            help='max number of chrome instances simultaneously browsing pages')
    arg_parser.add_argument(
            '--proxy', dest='proxy', default=None, help='http proxy')
    arg_parser.add_argument(
            '--warcprox-auto', dest='warcprox_auto', action='store_true',
            help=(
                'when needed, choose an available instance of warcprox from '
                'the rethinkdb service registry'))
    arg_parser.add_argument(
            '--skip-extract-outlinks', dest='skip_extract_outlinks',
            action='store_true', help=argparse.SUPPRESS)
    arg_parser.add_argument(
            '--skip-visit-hashtags', dest='skip_visit_hashtags',
            action='store_true', help=argparse.SUPPRESS)
    arg_parser.add_argument(
            '--skip-youtube-dl', dest='skip_youtube_dl',
            action='store_true', help=argparse.SUPPRESS)
    add_common_options(arg_parser, argv)

    args = arg_parser.parse_args(args=argv[1:])
    configure_logging(args)
    brozzler.chrome.check_version(args.chrome_exe)

    def dump_state(signum, frame):
        signal.signal(signal.SIGQUIT, signal.SIG_IGN)
        try:
            state_strs = []
            frames = sys._current_frames()
            threads = {th.ident: th for th in threading.enumerate()}
            for ident in frames:
                if threads[ident]:
                    state_strs.append(str(threads[ident]))
                else:
                    state_strs.append('<???:thread:ident=%s>' % ident)
                stack = traceback.format_stack(frames[ident])
                state_strs.append(''.join(stack))
            logging.info(
                    'dumping state (caught signal %s)\n%s' % (
                        signum, '\n'.join(state_strs)))
        except BaseException as e:
            logging.error('exception dumping state: %s' % e)
        finally:
            signal.signal(signal.SIGQUIT, dump_state)

    rr = rethinker(args)
    frontier = brozzler.RethinkDbFrontier(rr)
    service_registry = doublethink.ServiceRegistry(rr)
    worker = brozzler.worker.BrozzlerWorker(
            frontier, service_registry, max_browsers=int(args.max_browsers),
            chrome_exe=args.chrome_exe, proxy=args.proxy,
            warcprox_auto=args.warcprox_auto,
            skip_extract_outlinks=args.skip_extract_outlinks,
            skip_visit_hashtags=args.skip_visit_hashtags,
            skip_youtube_dl=args.skip_youtube_dl)

    signal.signal(signal.SIGQUIT, dump_state)
    signal.signal(signal.SIGTERM, lambda s,f: worker.stop())
    signal.signal(signal.SIGINT, lambda s,f: worker.stop())

    th = threading.Thread(target=worker.run, name='BrozzlerWorkerThread')
    th.start()
    th.join()
    logging.info('brozzler-worker is all done, exiting')
1227766
function(element, handler, arg) {
		var hasspirit = gui.hasModule('gui-spirits@wunderbyte.com');
		var directive = gui.Crawler.CONTINUE;
		var spirit = hasspirit ? element.spirit : null;
		if (spirit) {
			directive = spirit.oncrawler(this);
		}
		if (!directive) {
			if (handler) {
				if (gui.Type.isFunction(handler.handleElement)) {
					directive = handler.handleElement(element, arg);
				}
				if (directive !== gui.Crawler.STOP) {
					if (spirit && gui.Type.isFunction(handler.handleSpirit)) {
						directive = this._handleSpirit(spirit, handler);
					}
				}
			}
		}
		if (!directive) {
			directive = gui.Crawler.CONTINUE;
		}
		return directive;
	}
41209
@DataProvider(parallel = true)
    public static Iterator<String[]> availableBrowsers(ITestContext context, Constructor<?> testConstructor)
            throws Exception {

        Map<String, String> map = new HashMap<String, String>();
        List<String> browsers = gridBrowsers(map);

        return buildIterator(browsers);
    }
790579
function(type, args) {
        Base.prototype.fireEvent.call(this, type, args);

        var element = this.element,
            node = this.node,
            event = $.Event(type + '.toolkit.' + this.keyName);
            event.context = this;

        // Trigger event on the element and the node
        if (element) {
            element.trigger(event, args || []);
        }

        if (node) {
            node.trigger(event, args || []);
        }
    }
840407
def _proxy_kwargs(browser_name, proxy, browser_kwargs={}):  # pylint: disable=dangerous-default-value
    

    proxy_dict = {
        "httpProxy": proxy.proxy,
        "proxyType": 'manual',
    }

    if browser_name == 'firefox' and 'desired_capabilities' not in browser_kwargs:
        # This one works for firefox locally
        wd_proxy = webdriver.common.proxy.Proxy(proxy_dict)
        browser_kwargs['proxy'] = wd_proxy
    else:
        # This one works with chrome, both locally and remote
        # This one works with firefox remote, but not locally
        if 'desired_capabilities' not in browser_kwargs:
            browser_kwargs['desired_capabilities'] = {}

        browser_kwargs['desired_capabilities']['proxy'] = proxy_dict

    return browser_kwargs
762806
public static void main(String[] arg) {

        System.getProperties().put("sun.java2d.noddraw", "true");

        // (ulrivo): read all arguments from the command line
        String  lowerArg;
        String  urlid        = null;
        String  rcFile       = null;
        boolean autoConnect  = false;
        boolean urlidConnect = false;

        bMustExit = true;

        for (int i = 0; i < arg.length; i++) {
            lowerArg = arg[i].toLowerCase();

            if (lowerArg.startsWith("--")) {
                lowerArg = lowerArg.substring(1);
            }

            i++;

            if (lowerArg.equals("-driver")) {
                defDriver   = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-url")) {
                defURL      = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-user")) {
                defUser     = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-password")) {
                defPassword = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-urlid")) {
                urlid        = arg[i];
                urlidConnect = true;
            } else if (lowerArg.equals("-rcfile")) {
                rcFile       = arg[i];
                urlidConnect = true;
            } else if (lowerArg.equals("-dir")) {
                defDirectory = arg[i];
            } else if (lowerArg.equals("-script")) {
                defScript = arg[i];
            } else if (lowerArg.equals("-noexit")) {
                bMustExit = false;

                i--;
            } else if (lowerArg.equals("-help")) {
                showUsage();
                return;
            } else {
                /* Syntax ERRORS should either throw or exit with non-0 status.
                 * In our case, it may be unsafe to exit, so we throw.
                 * (I.e. should provide easy way for caller to programmatically
                 * determine that there was an invocation problem).
                 */

                throw new IllegalArgumentException(
                        "Try:  java... " + DatabaseManagerSwing.class.getName()
                        + " --help");
                // No reason to localize, since the main syntax message is
                // not localized.
            }
        }

        DatabaseManagerSwing m =
            new DatabaseManagerSwing(new JFrame("HSQL Database Manager"));

        // Added: (weconsultants@users): Need databaseManagerSwing for later Reference
        refForFontDialogSwing = m;

        m.main();

        Connection c = null;

        m.setWaiting("Initializing");

        try {
            if (autoConnect && urlidConnect) {
                throw new IllegalArgumentException(
                    "You may not specify both (urlid) AND (url/user/password).");
            }

            if (autoConnect) {
                c = ConnectionDialogSwing.createConnection(defDriver, defURL,
                        defUser, defPassword);
            } else if (urlidConnect) {
                if (urlid == null) {
                    throw new IllegalArgumentException(
                        "You must specify an 'urlid' to use an RC file");
                }

                autoConnect = true;

                String rcfilepath = (rcFile == null) ? DEFAULT_RCFILE
                                                     : rcFile;
                RCData rcdata     = new RCData(new File(rcfilepath), urlid);

                c = rcdata.getConnection(
                    null, System.getProperty("sqlfile.charset"),
                    System.getProperty("javax.net.ssl.trustStore"));
            } else {
                c = ConnectionDialogSwing.createConnection(m.jframe,
                        "Connect");
            }
        } catch (Exception e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        } finally {
            m.setWaiting(null);
        }

        if (c != null) {
            m.connect(c);
        }

        // Added: (weconsultants@users): For preloadng FontDialogSwing
        FontDialogSwing.creatFontDialog(refForFontDialogSwing);
        m.start();
    }
469886
def init_argparser_working_dir(
            self, argparser,
            explanation='',
            help_template=(
                'the working directory; %(explanation)s'
                'default is current working directory (%(cwd)s)'),
            ):
        

        cwd = self.toolchain.join_cwd()
        argparser.add_argument(
            '--working-dir', dest=WORKING_DIR,
            metavar=metavar(WORKING_DIR),
            default=cwd,
            help=help_template % {'explanation': explanation, 'cwd': cwd},
        )
1331512
function(elm, handler, arg, start) {
		var win, spirit, directive = this._handleElement(elm, handler, arg);
		switch (directive) {
			case gui.Crawler.CONTINUE:
			case gui.Crawler.SKIP_CHILDREN:
				if (directive !== gui.Crawler.SKIP_CHILDREN) {
					if (elm.childElementCount) {
						this._descend(elm.firstElementChild, handler, arg, false);
					} else if (this.global && elm.localName === "iframe") {
						/*
						 * TODO: Make iframe transcend work even without spirit support.
						 */
						if ((spirit = elm.spirit) && (spirit instanceof gui.IframeSpirit)) {
							win = elm.ownerDocument.defaultView;
							if (gui.Type.isFunction(handler.transcend)) {
								handler.transcend(
									spirit.contentWindow, 
									spirit.xguest, 
									spirit.$instanceid
								);
							}
						}
					}
				}
				if (!start) {
					var next = elm.nextElementSibling;
					if (next !== null) {
						this._descend(next, handler, arg, false);
					}
				}
				break;
		}
	}
453695
public static void main(String[] args) throws IOException, TrustyUriException {
		if (args.length < 2) {
			throw new RuntimeException("Not enough arguments: <file> <graph-uri1> (<graph-uri2> ...)");
		}
		File inputFile = new File(args[0]);
		List<IRI> baseUris = new ArrayList<IRI>();
		for (int i = 1 ; i < args.length ; i++) {
			String arg = args[i];
			if (arg.contains("://")) {
				baseUris.add(SimpleValueFactory.getInstance().createIRI(arg));
			} else {
				BufferedReader reader = new BufferedReader(new FileReader(arg));
				String line;
				while ((line = reader.readLine()) != null) {
				   baseUris.add(SimpleValueFactory.getInstance().createIRI(line));
				}
				reader.close();
			}
		}
		RdfFileContent content = RdfUtils.load(new TrustyUriResource(inputFile));
		String outputFilePath = inputFile.getPath().replaceFirst("[.][^.]+$", "") + ".t";
		RDFFormat format = content.getOriginalFormat();
		if (!format.getFileExtensions().isEmpty()) {
			outputFilePath += "." + format.getFileExtensions().get(0);
		}
		transform(content, new File(outputFilePath), baseUris.toArray(new IRI[baseUris.size()]));
	}
212979
def _init_browser(self):
        
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument('--disable-extensions')
        chrome_options.add_argument('--disable-infobars')
        chrome_options.add_argument('--ignore-certificate-errors')
        chrome_options.add_experimental_option('prefs', {
            'profile.managed_default_content_settings.notifications': 1
        })

        browser = webdriver.Chrome(chrome_options=chrome_options)
        browser.set_page_load_timeout(10)
        browser.implicitly_wait(1)
        browser.maximize_window()
        browser.get(settings.HARNESS_URL)
        self._browser = browser
        if not wait_until(lambda: 'Thread' in browser.title, 30):
            self.assertIn('Thread', browser.title)
574594
@Given("^I( securely)? browse to '(.+?)'$")
    public void seleniumBrowse(String isSecured, String path) throws Exception {
        assertThat(path).isNotEmpty();

        if (commonspec.getWebHost() == null) {
            throw new Exception("Web host has not been set");
        }

        if (commonspec.getWebPort() == null) {
            throw new Exception("Web port has not been set");
        }
        String protocol = "http://";
        if (isSecured != null) {
            protocol = "https://";
        }

        String webURL = protocol + commonspec.getWebHost() + commonspec.getWebPort();

        commonspec.getDriver().get(webURL + path);
        commonspec.setParentWindow(commonspec.getDriver().getWindowHandle());
    }
1164435
def chrome_driver(self, **kwargs):
        
        options = webdriver.ChromeOptions()
        options.add_argument('--no-sandbox')

        prefs = {"profile.managed_default_content_settings.images": kwargs.get('images', 0)}
        options.add_experimental_option("prefs", prefs)
        driver = webdriver.Chrome(chrome_options=options)
        driver.set_window_size(1366, 700)
        driver.set_window_position(32, 0)
        driver.set_page_load_timeout(kwargs.get('to', 30))
        return driver
912816
function (args) {
  if (false === (this instanceof Presentation)) throw new Error('new operator required');
  args = args || {};
  if (!args.attributes) {
    args.attributes = [];
  }
  args.attributes.push(new Attribute({name: 'name', type: 'String'}));
  args.attributes.push(new Attribute({name: 'modelName', type: 'String'}));
  args.attributes.push(new Attribute({name: 'contents', type: 'Object', value: []}));
  Model.call(this, args);
  this.modelType = "Presentation";
}
821944
function FirefoxDriver(
  desiredCapabilities,
  requiredCapabilities
  ) {
  var instance;
  var first = desiredCapabilities;
  var len = arguments.length;

  if (!len) {
    instance = new Class();
  } else if (len === 1 || len === 2) {
    assert(first)
      .extends(Capabilities)
      .or(FirefoxProfile)
      .throws(
        'The first argument wasn\'t an instanceof Capabilities.'
        );
    if (len === 1) {
      instance = new Class(first._instance);
    } else if (len === 2) {
      assert(requiredCapabilities)
        .extends(Capabilities)
        .throws(
          'The second argument must be an instance of Capabilities.'
          );
      instance = new Class(first._instance, requiredCapabilities._instance);
    }
  } else {
    throw new Error('The wrong number of arguments was given.');
  }

  addFinalProp(this, '_instance', instance);
}
688815
def browser
      unless @browser
        @appium_driver = Appium::Driver.new @options, false
        # browser is the standard selenium driver without any appium methods
        @browser = @appium_driver.start_driver

        main = Process.pid
        at_exit do
          # Store the exit status of the test run since it goes away after calling the at_exit proc...
          @exit_status = $!.status if $!.is_a?(SystemExit)
          quit if Process.pid == main
          exit @exit_status if @exit_status # Force exit with stored status
        end
      end
      @browser
    end