当前位置: 首页>>代码示例>>Python>>正文


Python Context.set_current_page方法代码示例

本文整理汇总了Python中context.Context.set_current_page方法的典型用法代码示例。如果您正苦于以下问题:Python Context.set_current_page方法的具体用法?Python Context.set_current_page怎么用?Python Context.set_current_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context.Context的用法示例。


在下文中一共展示了Context.set_current_page方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import set_current_page [as 别名]
    def __init__(self):
        for base in Page.__bases__:
            base.__init__(self)
        self._robot_handler = RobotHandler(self)
        self._option_handler = OptionHandler(self)
        self._yaml_handler = YAMLHandler(self)

        try:
            self.name
        except AttributeError:
            self.name = self._titleize(self.__class__.__name__)

        # Required Attributes in options ##
        self.browser = self._option_handler.get("browser", None)
        self.baseurl = self._option_handler.get("baseurl", None)

        # Setting Up Optional Selenium2Library attributes with OptionHandler ##
        selenium_speed = self._option_handler.get("selenium_speed", 0)
        selenium_implicit_wait = self._option_handler.get("selenium_implicit_wait", 5)

        self.set_selenium_timeout(selenium_implicit_wait)
        self.set_selenium_implicit_wait(selenium_implicit_wait)
        self.set_selenium_speed(selenium_speed)

        _shared_cache = Context.get_cache()
        if _shared_cache is not None:
            self._cache = _shared_cache
        Context.set_cache(self._cache)

        if Context.in_robot():
            Context.set_current_page("pageobjects.Page")
        KeywordManager().add_page_methods(self)
开发者ID:charleshamel73,项目名称:robot-pageobjects,代码行数:34,代码来源:page.py

示例2: run_keyword

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import set_current_page [as 别名]
    def run_keyword(self, name, args, kwargs):
        """
        RF Dynamic API hook implementation that maps method names to their actual functions.

        :param name: The keyword name from robot
        :type name: str
        :param args: the args from robot
        :type args: list
        :param kwargs: a dict of additional args
        :type kwargs: dict
        :return: callable function
        :rtype: callable
        """
        # Translate back from Robot Framework name to actual method
        ret = None

        func_mapping = KeywordManager().get_meth_mapping_from_robot_alias(self, name)
        meth = func_mapping.func
        try:
            if "${" in func_mapping.func_alias:
                args = self._parse_embedded_args(name, func_mapping.func_alias)
            ret = meth(self, *args, **kwargs)
        except Exception, e:
            Context.set_current_page("automationpages.Page")
            # Pass up the stack, so we see complete stack trace in Robot trace logs
            BuiltIn().fail(str(e))
开发者ID:charleshamel73,项目名称:robot-pageobjects,代码行数:28,代码来源:page.py

示例3: meth

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import set_current_page [as 别名]
        try:
            if "${" in func_mapping.func_alias:
                args = self._parse_embedded_args(name, func_mapping.func_alias)
            ret = meth(self, *args, **kwargs)
        except Exception, e:
            Context.set_current_page("automationpages.Page")
            # Pass up the stack, so we see complete stack trace in Robot trace logs
            BuiltIn().fail(str(e))

        if isinstance(ret, Page):
            libnames = Context.get_libraries()
            classname = ret.__class__.__name__
            for names in libnames:
                # If we find a match for the class name, set the pointer in Context.
                if names.split(".")[-1:][0] == classname:
                    Context.set_current_page(names)

        if ret is None:
            func = meth.__name__
            if func in Selenium2Library.__dict__.values():
                ret = self
            else:
                for base in Selenium2Library.__bases__:
                    if func in base.__dict__.values():
                        ret = self
                        break

        return ret
    
    def get_keyword_documentation(self, kwname):
        """
开发者ID:charleshamel73,项目名称:robot-pageobjects,代码行数:33,代码来源:page.py


注:本文中的context.Context.set_current_page方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。