Пример #1
0
    def __init__(self, *args, **kwargs) -> None:
        locators_path = kwargs.pop("locators_path",
                                   locators.default_locators_path())

        # Parse user-given plugins
        plugins = kwargs.get("plugins", "")
        plugins = set(p for p in plugins.split(",") if p)

        # Add testability if requested
        if "use_testability" in args:
            args = [arg for arg in args if arg != "use_testability"]
            plugins.add("SeleniumTestability")

        # Refresh plugins list
        kwargs["plugins"] = ",".join(plugins)

        SeleniumLibrary.__init__(self, *args, **kwargs)
        self.logger = logging.getLogger(__name__)
        self.using_testability = bool("SeleniumTestability" in plugins)

        # Add support for locator aliases
        self.locators = locators.LocatorsDatabase(locators_path)
        self._element_finder.register("alias",
                                      self._find_by_alias,
                                      persist=True)

        self._embedding_screenshots = False
        self._previous_screenshot_directory = None
        # Embed screenshots in logs by default
        if not notebook.IPYTHON_AVAILABLE:
            self._embedding_screenshots = True
            self._previous_screenshot_directory = self.set_screenshot_directory(
                EMBED)
Пример #2
0
    def __init__(self, *args, **kwargs) -> None:
        self.logger = logging.getLogger(__name__)

        self.using_testability = False
        if "use_testability" in args:
            self.using_testability = True
            args = filter(lambda x: x != "use_testability", args)
        if "plugins" in kwargs.keys(
        ) and "SeleniumTestability" in kwargs["plugins"]:
            # SeleniumTestability already included as plugin
            self.using_testability = True
        elif self.using_testability and "plugins" in kwargs.keys():
            # Adding SeleniumTestability as SeleniumLibrary plugin
            kwargs["plugins"] += ",SeleniumTestability"
        elif self.using_testability:
            # Setting SeleniumTestability as SeleniumLibrary plugin
            kwargs["plugins"] = "SeleniumTestability"

        locators_path = kwargs.pop("locators_path", locators.DEFAULT_DATABASE)

        SeleniumLibrary.__init__(self, *args, **kwargs)
        self.drivers = []
        self.locators = locators.LocatorsDatabase(locators_path)
        self._element_finder.register("alias",
                                      self._find_by_alias,
                                      persist=True)
Пример #3
0
 def __init__(self):
     SeleniumLibrary.__init__(self, 30)
     self.add_library_components([
         BrowserKeywords(self),
         ElementKeywords(self),
         MyCustomizedLibraryKeywords(self)
     ])
Пример #4
0
    def __init__(self, timeout=60, host=DEFAULT_HOST, port=DEFAULT_PORT, plugin_dir=""):
        """Load the wbSelenium library with arguments for Robot's
        SeleniumLibrary and selenium-server.

        Classes defined in python files are searched in the base directory
        and plugin directory. This class inherits from SeleniumLibrary and
        also all other classes specified in the plugin and base
        directories. Dynamic inheritance is implemented using the
        Class.__bases__ += method which means all external classes must be
        new style (inherit from object). """
        SeleniumLibrary.__init__(self, timeout, host, port)
        # use plugin dir if specified, otherwise just load WikiBhasha base
        extension_paths = [wbSelenium.BASE_DIR] + (plugin_dir and [os.path.abspath(plugin_dir)] or [])
        # get list of all of the javascript files and flatten list
        js_files = sum([self._get_ext_js(path) for path in extension_paths], [])
        self._user_ext_file = js_files and TempJSExtensionFile() or None
        def process_curry(file):
            self._process_js_ext(file, self._user_ext_file)
        map(process_curry, js_files)
        # inherit from other extensions (must take a flat tuple)
        ext_classes = tuple(sum([self._get_ext_classes(path) for path in extension_paths], []))
        # plugins override SeleniumLibrary in MRO
        wbSelenium.__bases__ = ext_classes + wbSelenium.__bases__ 
        for klass in ext_classes:
            log("wbSelenium imported class: " + klass.__name__)
            #super(klass, self).__init__()
            klass.__init__(self)
Пример #5
0
 def __init__(self):
     SeleniumLibrary.__init__(self, 30)
     self.add_library_components([
         BrowserKeywords(self),
         ElementKeywords(self),
         GoBearCoreKeywords(self)
     ])
Пример #6
0
 def __init__(self, timeout=5.0, implicit_wait=0.0,
              run_on_failure='Capture Page Screenshot',
              screenshot_root_directory=None):
     SeleniumLibrary.__init__(self, timeout=timeout, implicit_wait=implicit_wait,
                              run_on_failure=run_on_failure,
                              screenshot_root_directory=screenshot_root_directory)
     self.add_library_components([BrowserKeywords(self),
                                  DesiredCapabilitiesKeywords(self)])
Пример #7
0
class GUILibrary(BasicOperations):
   def __init__(self):
      BasicOperations.__init__(self)
      self.seleniumLib = SeleniumLibrary()
      self.seleniumLib.__init__(timeout=20.0)
      print "Selenium library initialized"

   def helloKeyword(self):
      print "This is hello keyword!"
    def __init__(self,
                 timeout=5.0,
                 implicit_wait=0.0,
                 run_on_failure='Capture Page Screenshot',
                 screenshot_root_directory=None):

        # self._builtin = BuiltIn()
        SeleniumLibrary.__init__(
            self,
            timeout=timeout,
            implicit_wait=implicit_wait,
            run_on_failure=run_on_failure,
            screenshot_root_directory=screenshot_root_directory)
        # ContextPatch.__init__(self)
        self.add_library_components([ElementKeywordsExtension(self)])
 def __init__(self,
              timeout=5.0,
              implicit_wait=0.0,
              run_on_failure='Capture Page Screenshot',
              screenshot_root_directory=None,
              plugins=None,
              event_firing_webdriver=None):
     SeleniumLibrary.__init__(self,
                              timeout=5.0,
                              implicit_wait=0.0,
                              run_on_failure='Capture Page Screenshot',
                              screenshot_root_directory=None,
                              plugins=None,
                              event_firing_webdriver=None)
     self.logger = get_logger("SeleniumProxy")
     self.logger.debug("__init__()")
     if is_truthy(event_firing_webdriver):
         self.event_firing_webdriver = self._parse_listener(
             event_firing_webdriver)
     self.add_library_components(
         [BrowserKeywords(self), HTTPKeywords(self)])
Пример #10
0
 def __init__(self,
              timeout=5.0,
              implicit_wait=0.0,
              run_on_failure='Capture Page Screenshot',
              screenshot_root_directory=None,
              plugins=None,
              event_firing_webdriver=None):
     SeleniumLibrary.__init__(self,
                              timeout=5.0,
                              implicit_wait=0.0,
                              run_on_failure='Capture Page Screenshot',
                              screenshot_root_directory=None,
                              plugins=None,
                              event_firing_webdriver=None)
     self.ROBOT_LIBRARY_LISTENER = RobotFrameworkListener()
     self.event_firing_webdriver = SeleniumProxyListener
     if is_truthy(event_firing_webdriver):
         self.event_firing_webdriver = self._parse_listener(
             event_firing_webdriver)
     self.add_library_components(
         [BrowserKeywords(self), HTTPKeywords(self)])
Пример #11
0
 def __init__(self):
     SeleniumLibrary.__init__(self)
Пример #12
0
 def __init__(self):
     SeleniumLibrary.__init__(self, 30)
     self.add_library_components([
         TableKeyword(self),
     ])
Пример #13
0
 def __init__(self, *args, **kwargs) -> None:
     self.logger = logging.getLogger(__name__)
     SeleniumLibrary.__init__(self, *args, **kwargs)
     self.drivers = []
Пример #14
0
 def __init__(self):
     SeleniumLibrary.__init__(self, 30)
     self.add_library_components(
         [Module1(self), Module2(self),
          OtherModules(self)])
Пример #15
0
    def __init__(self, implicit_wait=15.0, **kwargs):

        self._builtin = BuiltIn()
        SeleniumLibrary.__init__(self, implicit_wait=implicit_wait, **kwargs)
        ContextPatch.__init__(self)
        self.add_library_components([ElementKeywordsExtension(self)])
    def __init__(self, implicit_wait=15.0, **kwargs):
        # pylint: disable=line-too-long
        """ExtendedSeleniumLibrary can be imported with optional arguments.

        Arguments:
        - ``timeout``: The maximum value to wait for all waiting actions. (Default 5.0)
                       It can be set later with `Set Selenium Timeout`.
                       See `introduction` for more information about ``timeout``.
        - ``implicit_wait``: The maximum implicit timeout value to wait when looking
                             for elements. (Default 15.0)
                             It can be later set with `Set Selenium Implicit Wait`.
                             See [http://goo.gl/8ePMo6|WebDriver: Advanced Usage]
                             section of the SeleniumHQ documentation for more information about
                             WebDriver's implicit wait functionality.
        - ``run_on_failure``: The name of a keyword (from any available libraries) to execute
                              when a ExtendedSeleniumLibrary keyword fails. By default
                              `Capture Page Screenshot` will be used to take a screenshot of
                              the current page.
                              Using the value "Nothing" will disable this feature altogether.
                              See `Register Keyword To Run On Failure` keyword for
                              more information about this functionality.
        - ``screenshot_root_directory``: The default root directory that screenshots should be
                                         stored in. If not provided, the default directory will be
                                         where [http://goo.gl/lES6WM|Robot Framework] places its
                                         logfile.
        - ``block_until_page_ready``: A boolean flag to block the execution until
                                      the page is ready. (Default True)
        - ``browser_breath_delay``: The delay value in seconds to give the browser enough time to
                                    complete current execution. (Default 0.05)
        - ``ensure_jq``: A boolean flag to ensure jQuery library is loaded on the page.
                         ``sizzle`` locator strategy will depend on this flag. (Default True)
        - ``poll_frequency``: The delay value in seconds to retry the next step. (Default 0.2)

        Examples:
        | Library `|` ExtendedSeleniumLibrary `|` 15                                            | # Sets default timeout to 15 seconds                                       |
        | Library `|` ExtendedSeleniumLibrary `|` 0 `|` 5                                       | # Sets default timeout to 0 seconds and default implicit_wait to 5 seconds |
        | Library `|` ExtendedSeleniumLibrary `|` 5 `|` run_on_failure=Log Source               | # Sets default timeout to 5 seconds and runs `Log Source` on failure       |
        | Library `|` ExtendedSeleniumLibrary `|` implicit_wait=5 `|` run_on_failure=Log Source | # Sets default implicit_wait to 5 seconds and runs `Log Source` on failure |
        | Library `|` ExtendedSeleniumLibrary `|` timeout=10      `|` run_on_failure=Nothing    | # Sets default timeout to 10 seconds and does nothing on failure           |
        """
        # pylint: disable=line-too-long
        self._inputs = {
            'block_until_page_ready':
            bool(kwargs.pop('block_until_page_ready', True)),
            'browser_breath_delay':
            float(kwargs.pop('browser_breath_delay', 0.05)),
            'ensure_jq':
            bool(kwargs.pop('ensure_jq', True)),
            'poll_frequency':
            float(kwargs.pop('poll_frequency', 0.2)),
        }
        self._builtin = BuiltIn()
        SeleniumLibrary.__init__(self, implicit_wait=implicit_wait, **kwargs)
        self.add_library_components([
            ExtendedElementKeywords(self),
            ExtendedFormElementKeywords(self),
            ExtendedJavascriptKeywords(self),
            ExtendedSelectElementKeywords(self),
            ExtendedWaitingKeywords(self)
        ])
        self._implicit_wait_in_secs = float(
            implicit_wait) if implicit_wait is not None else 15.0
        self._page_ready_keyword_list = []
Пример #17
0
 def __init__(self):
     SeleniumLibrary.__init__(self, timeout=90)
     self.add_library_components([
         CommonCustomKeywords(self),
         WaitTimeHandler(self),
     ])
Пример #18
0
 def __init__(self):
     SeleniumLibrary.__init__(self, 30)
     self.waiting_management = WaitingKeywords(self)