def main():

    """
    Start main function.
    """

    def signal_handler(signum, frame):
        raise SystemExit

    def exit_handler():
        print("exiting")
        exit(0)

    register_exit(exit_handler)
    signal(SIGINT, signal_handler)

    runner = Runner()
    print("Running {0} example.".format(runner.project_name))
    runner.start()

    try:
        signal.pause()
    except AttributeError:
        while True:
            sleep(0.5)
Exemple #2
0
 def __init__(self, scenario, download_directory=default_download_directory,
              app_host=None, app_port=None, executable_path=None,
              pages=None):
     # Contract
     must_be(download_directory, "download_directory", (type(None), str))
     must_be(app_host, "app_host", (type(None), str))
     must_be(app_port, "app_port", (type(None), Number))
     must_be(executable_path, "executable_path", (type(None), str))
     must_be(pages, "pages", (dict, type(None)))
     # TODO[TJ]: This should be implemented as part of the future contracts
     # library
     if pages is not None:
         for key, value in pages.items():
             must_be(key, "pages key", str)
             must_be(value, "pages value", AppPage)
     #
     self.scenario = scenario
     if download_directory is not None:
         options = ChromeOptions()
         prefs = {"download.default_directory": download_directory}
         options.add_experimental_option('prefs', prefs)
     else:
         options = None
     if app_host is not None:
         self.app_host = app_host
     if app_port is not None:
         self.app_port = app_port
     if executable_path is not None:
         self.executable_path = executable_path
     self.pages = pages
     super(ChromeBrowser, self).__init__(
         executable_path=self.executable_path, chrome_options=options)
     register_exit(self.quit)
def main():

    """
    Start main function.
    """

    def signal_handler(signum, frame):
        raise SystemExit

    def exit_handler():
        print("exiting.")
        exit(0)

    register_exit(exit_handler)
    signal(SIGINT, signal_handler)

    runner = Runner()
    print("Running {0} example.".format(runner.project_name))
    runner.start()

    try:
        signal.pause()
    except AttributeError:
        while True:
            sleep(0.5)
Exemple #4
0
    def __init__(self, scenario, selenium_host, app_host=None, app_port=None,
                 pages=None):

        must_be(app_host, "app_host", (type(None), str))
        must_be(app_port, "app_port", (type(None), Number))
        must_be(pages, "pages", (dict, type(None)))
        must_be(selenium_host, "selenium_host", str)

        if pages is not None:
            for key, value in pages.items():
                must_be(key, "pages key", str)
                must_be(value, "pages value", AppPage)

        self.scenario = scenario
        self.pages = pages
        self.app_host = app_host
        self.app_port = app_port

        super(RemoteBrowser, self).__init__(
            desired_capabilities=DesiredCapabilities.CHROME,
            command_executor='{}:4444/wd/hub'.format(selenium_host))
        register_exit(self.quit)