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


Python BuiltIn._info方法代码示例

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


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

示例1: demo_input_text

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _info [as 别名]
 def demo_input_text(self,locator,text):
     # a demo by YT for implemnting the same function as 'Input Text'
     """Description:
     Types the given `text` into text field identified by `locator`.
     See `introduction` for details about locating elements.
     """
     appiumlib = BuiltIn().get_library_instance('SongzAppiumLibrary')
     appiumlib._info("Typing text '%s' into text field '%s'" % (text, locator))
     appiumlib._element_input_text_by_locator(locator, text)
开发者ID:hyteer,项目名称:testing,代码行数:11,代码来源:common.py

示例2: select_iframe

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _info [as 别名]
    def select_iframe(self, locator):
        """Sets iframe identified by `locator` as current frame.

        Key attributes for frames are `id` and `name.` See `introduction` for
        details about locating elements.
        """
        selenium2lib = BuiltIn().get_library_instance('Selenium2Library')
        selenium2lib._info("Selecting iframe '%s'." % locator)
        element = selenium2lib._element_find(locator, True, True, tag='iframe')
        selenium2lib._current_browser().switch_to_frame(element)
开发者ID:FonPhannida,项目名称:robotx,代码行数:12,代码来源:_pagetests.py

示例3: AircvLibrary

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _info [as 别名]
class AircvLibrary(object):
    """ Wrapper Keywords for RobotFramework to click mobile screen, based on opencv & aircv.
    """

    def __init__(self):
        self.TH = 0.85  # THRESHOLD
        self._screen = ""
        self._timeout = 10
        self.img_path = ""
        self.output_dir = ""
        self._mobilelib = ""
        self._driver = ""
        """only can achieve BuiltIn().get_variables() at running time"""
        # sys_variables = BuiltIn().get_variables()
        # self.output_dir = os.path.abspath(sys_variables['${OUTPUTDIR}'])

    def _get_appium_handle(self):
        if not self._mobilelib:
            self._mobilelib = BuiltIn().get_library_instance(CUSTOMER_LIBRARY_NAME)
        if not self._driver:
            self._driver = self._mobilelib._current_application()

    def _capture_background(self, filename="screen.png"):
        """
        :param filename: the background screen
        :return: None
        """
        self._screen = os.path.join(self.output_dir, filename)
        self._mobilelib.capture_page_screenshot_without_html_log(os.path.join(self.output_dir, self._screen))

    def _prepare(self):
        """ update background  screen
        """
        self._get_appium_handle()

        if not self.output_dir:
            sys_variables = BuiltIn().get_variables()
            self.output_dir = os.path.abspath(sys_variables['${OUTPUTDIR}'])

        if os.path.isfile(self._screen):
            os.remove(self._screen)
        self._capture_background()

        start_time = time()
        while time() - start_time < self._timeout:
            if os.path.isfile(self._screen):
                return
            sleep(0.2)
            continue
        self._mobilelib._info("[>>>]:Capture Background failed")

    def mobile_image_threshold(self, threshold):
        self.TH = float(threshold)

    def mobile_image_set_timeout(self, time_num):
        """
        :param time_num:  wait in N secs to capture background screen
        :return: None
        """
        self._timeout = time_num

    def mobile_image_set_path(self, path='None'):
        """
        :param path: set the target image path
        :return: None
        """
        self.img_path = path

    def mobile_image_listdir(self):
        """show the target image directory's content
        """
        self._get_appium_handle()
        self._mobilelib._info("*" * 6)
        if self.img_path:
            self._mobilelib._info(self.img_path)
            self._mobilelib._info('-' * 6)
            content = os.listdir(self.img_path)
            if content.__len__() > 0:
                for item in content:
                    self._mobilelib._info(item)
            else:
                self._mobilelib._info("[>>>]:None Image")
        else:
            self._mobilelib._info("[>>>]:Image Path is NONE")
        self._mobilelib._info("*" * 6)

    def _image_click(self, target, index=1):
        """
        :param target: the target image that should be clicked
        :param index: select the N-th element
        :return: match info
        """
        index = int(index)
        self._prepare()
        if self.img_path:
            target = os.path.join(self.img_path, target)
        else:
            self._mobilelib._info("[>>>] img path not set")
        im_source = ac.imread(self._screen.decode('utf-8').encode('gbk'))
        im_search = ac.imread(target.decode('utf-8').encode('gbk'))
#.........这里部分代码省略.........
开发者ID:Netease-AutoTest,项目名称:robotframework-aircvlibrary,代码行数:103,代码来源:AircvLibrary.py


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