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


Python web_ui.Tree类代码示例

本文整理汇总了Python中cfme.web_ui.Tree的典型用法代码示例。如果您正苦于以下问题:Python Tree类的具体用法?Python Tree怎么用?Python Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: tree

def tree(name, *path):
    """Get underlying Tree() object. And eventually click path.

    If the accordion is not active, will be clicked.
    Attention! The object is 'live' so when it's obscured, it won't work!

    Usage:
        accordion.tree("Something").click_path("level 1", "level 2")
        accordion.tree("Something", "level 1", "level 2")  # is the same

    Args:
        *path: If specified, it will directly pass these parameters into click_path of Tree.
            Otherwise it returns the Tree object.
    """
    try:
        if not is_active(name):
            click(name)
    except AccordionItemNotFound:
        click(name)

    root_element = sel.element(locate(name))
    if sel.is_displayed(DYNATREE, root=root_element):
        # Dynatree detected
        tree = Tree(sel.element(DYNATREE, root=root_element))
    elif sel.is_displayed(TREEVIEW, root=root_element):
        # treeview detected
        el = sel.element(TREEVIEW, root=root_element)
        tree_id = sel.get_attribute(el, 'id')
        tree = BootstrapTreeview(tree_id)

    if path:
        return tree.click_path(*path)
    else:
        return tree
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:34,代码来源:accordion.py

示例2: click_on_saved_reports

 def click_on_saved_reports(self):
     self.accordion.accordion_by_name("Saved Reports").click()
     self._wait_for_results_refresh()
     from cfme.web_ui import Tree
     tree = Tree("//tr[@title='All Saved Reports']/../..")
     tree.click_path("All Saved Reports")
     return VirtualIntelligence.SavedReportsSection(self.testsetup)
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:7,代码来源:virtual_intelligence.py

示例3: tree

def tree(name, *path):
    """Get underlying Tree() object. And eventually click path.

    If the accordion is not active, will be clicked.
    Attention! The object is 'live' so when it's obscured, it won't work!

    Usage:
        accordion.tree("Something").click_path("level 1", "level 2")
        accordion.tree("Something", "level 1", "level 2")  # is the same

    Args:
        *path: If specified, it will directly pass these parameters into click_path of Tree.
            Otherwise it returns the Tree object.
    """
    try:
        if not is_active(name):
            click(name)
    except AccordionItemNotFound:
        click(name)
    el = sel.element(
        # | for only single query
        "|".join([
            # Current tree for 5.4 (still with dhx)
            "../../div[contains(@class, 'dhxcont_global_content_area')]//"
            "ul[@class='dynatree-container']",
            # Newer accordion tree
            "../../..//div[@class='panel-body']//ul[@class='dynatree-container']"]),
        root=sel.element(locate(name)))
    tree = Tree(el)
    if path:
        return tree.click_path(*path)
    else:
        return tree
开发者ID:FilipB,项目名称:cfme_tests,代码行数:33,代码来源:accordion.py

示例4: tree

def tree(name, *path):
    """Get underlying Tree() object. And eventually click path.

    If the accordion is not active, will be clicked.
    Attention! The object is 'live' so when it's obscured, it won't work!

    Usage:
        accordion.tree("Something").click_path("level 1", "level 2")
        accordion.tree("Something", "level 1", "level 2")  # is the same

    Args:
        *path: If specified, it will directly pass these parameters into click_path of Tree.
            Otherwise it returns the Tree object.
    """
    click(name)
    tree = Tree(
        sel.first_from(
            # Current tree
            "../../div[contains(@class, 'dhxcont_global_content_area')]//"
            "ul[@class='dynatree-container']",
            # Legacy tree
            "../../div[contains(@class, 'dhxcont_global_content_area')]//"
            "div[@class='containerTableStyle']//table[not(ancestor::tr[contains(@style,'none')])]",
            root=sel.element(locate(name))
        )
    )
    if path:
        return tree.click_path(*path)
    else:
        return tree
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:30,代码来源:accordion.py

示例5: test_shuffle_top_level

def test_shuffle_top_level(group, on_finish_default):
    # Shuffle the order
    with menus.manage_folder(group) as folder:
        order = shuffle(folder.fields)
        for item in reversed(order):
            folder.move_first(item)
    # Now go and read the tree
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    checked = Tree.flatten_level(Tree.browse(tree, "All Reports"))
    assert checked == order, "The order differs!"
开发者ID:FilipB,项目名称:cfme_tests,代码行数:11,代码来源:test_menus.py

示例6: reorder_elements

 def reorder_elements(self, tab, box, *element_data):
     sel.force_navigate('service_dialog_edit', context={'dialog': self})
     if version.current_version() > "5.5":
         tree = accordion.tree("Dialog")
     else:
         tree = Tree("dialog_edit_treebox")
     tree.click_path(self.label, tab, box)
     list_ele = []
     for each_element in element_data:
         list_ele.append(each_element.get("ele_label"))
     ele_1 = self.element(list_ele[0])
     ele_2 = self.element(list_ele[1])
     sel.drag_and_drop(ele_1, ele_2)
     sel.click(form_buttons.save)
     flash.assert_no_errors()
开发者ID:FilipB,项目名称:cfme_tests,代码行数:15,代码来源:service_dialogs.py

示例7: update_element

 def update_element(self, second_element, element_data):
     navigate_to(self, 'Edit')
     if version.current_version() > "5.5":
         tree = accordion.tree("Dialog")
     else:
         tree = Tree("dialog_edit_treebox")
     tree.click_path(self.label, self.tab_label, self.box_label)
     self.add_element(second_element)
     list_ele = []
     list_ele.append(element_data.get("ele_label"))
     list_ele.append(second_element.get("ele_label"))
     tree.click_path(self.label, self.tab_label, self.box_label)
     ele_1 = self.element(list_ele[0])
     ele_2 = self.element(list_ele[1])
     sel.drag_and_drop(ele_1, ele_2)
     sel.click(form_buttons.save)
     flash.assert_no_errors()
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:17,代码来源:service_dialogs.py

示例8: test_shuffle_first_level

def test_shuffle_first_level(group, on_finish_default):
    # Find a folder
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    folders = Tree.browse(tree, "All Reports")
    # Select some folder that has at least 3 children
    folders = map(lambda item: item[0],
                filter(lambda item: isinstance(item[1], list) and len(item[1]) >= 3, folders))
    selected_folder = random.choice(folders)
    # Shuffle the order
    with menus.manage_folder(group, selected_folder) as folder:
        order = shuffle(folder.fields)
        for item in reversed(order):
            folder.move_first(item)
    # Now go and read the tree
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    checked = Tree.flatten_level(Tree.browse(tree, "All Reports", selected_folder))
    assert checked == order, "The order differs!"
开发者ID:FilipB,项目名称:cfme_tests,代码行数:19,代码来源:test_menus.py

示例9: tree

def tree(name, *path):
    """Get underlying Tree() object. And eventually click path.

    If the accordion is not active, will be clicked.
    Attention! The object is 'live' so when it's obscured, it won't work!

    Usage:
        accordion.tree("Something").click_path("level 1", "level 2")
        accordion.tree("Something", "level 1", "level 2")  # is the same

    Args:
        *path: If specified, it will directly pass these parameters into click_path of Tree.
            Otherwise it returns the Tree object.
    """
    try:
        if not is_active(name):
            logger.debug('Clicking accordion item %s because it is not active.', name)
            click(name)
    except AccordionItemNotFound:
        logger.debug('Clicking accordion item %s because AccordionItemNotFound raised.', name)
        click(name)

    locator = locate(name)
    # Wait a bit for any of the trees to appear
    wait_for(
        lambda: sel.is_displayed(ANY_TREE, root=locator),
        quiet=True, silent_failure=True, delay=0.2, timeout=5)
    if sel.is_displayed(DYNATREE, root=locator):
        # Dynatree detected
        tree = Tree(sel.element(DYNATREE, root=locator))
    elif sel.is_displayed(TREEVIEW, root=locator):
        # treeview detected
        el = sel.element(TREEVIEW, root=locator)
        tree_id = sel.get_attribute(el, 'id')
        tree = BootstrapTreeview(tree_id)
    else:
        raise TypeError('None of the supported trees was detected.')

    if path:
        return tree.click_path(*path)
    else:
        return tree
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:42,代码来源:accordion.py

示例10: make_tree_locator

from utils.db_queries import get_server_id, get_server_name, get_server_region
from utils.timeutil import parsetime
from utils.update import Updateable
from utils.wait import wait_for, TimedOutError


def make_tree_locator(acc_name, root_name):
    """ Make a specific locator for the tree in accordions.

    Args:
        acc_name: Accordion title
        root_name: Title of the root node of the tree in the accordion.
    """
    return '//span[.="%s"]/../..//table//tr[contains(@title, "%s")]/../..' % (acc_name, root_name)

settings_tree = Tree(make_tree_locator("Settings", "Region"))
access_tree = Tree(make_tree_locator("Access Control", "Region"))
diagnostics_tree = Tree(make_tree_locator("Diagnostics", "Region"))
database_tree = Tree(make_tree_locator("Database", "VMDB"))

server_roles = Form(
    fields=[
        ('ems_metrics_coordinator', "//input[@id='server_roles_ems_metrics_coordinator']"),
        ('ems_operations', "//input[@id='server_roles_ems_operations']"),
        ('ems_metrics_collector', "//input[@id='server_roles_ems_metrics_collector']"),
        ('reporting', "//input[@id='server_roles_reporting']"),
        ('ems_metrics_processor', "//input[@id='server_roles_ems_metrics_processor']"),
        ('scheduler', "//input[@id='server_roles_scheduler']"),
        ('smartproxy', "//input[@id='server_roles_smartproxy']"),
        ('database_operations', "//input[@id='server_roles_database_operations']"),
        ('smartstate', "//input[@id='server_roles_smartstate']"),
开发者ID:weissjeffm,项目名称:cfme_tests,代码行数:31,代码来源:configuration.py

示例11: Tree

import cfme.web_ui.flash as flash
import cfme.web_ui.toolbar as tb
from cfme.web_ui.tabstrip import select_tab
from cfme.web_ui import Form, Table, Tree, UpDownSelect, fill, Select, ScriptBox, DHTMLSelect,\
    Region, form_buttons, accordion, Input
import cfme.exceptions as exceptions
from utils.update import Updateable
from utils import error, version
from collections import Mapping
import re
from utils.log import logger
from utils import classproperty, pretty
from utils.wait import wait_for

tree = Tree({
    version.LOWEST: '//table//tr[@title="Datastore"]/../..',
    '5.3': '//ul//a[@title="Datastore"]/../../..'})

datastore_tree = partial(accordion.tree, "Datastore", "Datastore")
cfg_btn = partial(tb.select, 'Configuration')


def datastore_checkbox(name):
    return "//img[contains(@src, 'chk') and ../../td[normalize-space(.)='%s']]" % name


def table_select(name):
    cb = datastore_checkbox(name)
    wait_for(sel.is_displayed, [cb], num_sec=5, delay=0.2)
    sel.check(datastore_checkbox(name))
开发者ID:richardfontana,项目名称:cfme_tests,代码行数:30,代码来源:explorer.py

示例12: Tree

from functools import partial

from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash
from cfme.web_ui.menu import nav
from utils.update import Updateable
from utils.pretty import Pretty

rate_tree = Tree("//div[@id='cb_rates_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(Pretty):
    pretty_attrs = ['rate_loc', 'unit_select_loc']

    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem((By.CSS_SELECTOR, "input#rate_" + str(index)),
                        Select((By.CSS_SELECTOR, "select#per_time_" + str(index))))

rate_form = Form(
开发者ID:slouderm,项目名称:cfme_tests,代码行数:31,代码来源:chargeback.py

示例13: Tree

from functools import partial

from selenium.webdriver.common.by import By

import cfme.web_ui.accordion as accordion
import cfme.web_ui.toolbar as tb
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Select, Tree, fill, flash
from cfme.web_ui.menu import nav
from utils.update import Updateable

rate_tree = Tree("//div[@id='cb_rates_treebox']/ul")
tb_select = partial(tb.select, "Configuration")
tb_select_new_chargeback = nav.fn(partial(tb_select, "Add a new Chargeback Rate"))
tb_select_edit_chargeback = nav.fn(partial(tb_select, "Edit this Chargeback Rate"))


class RateFormItem(object):
    def __init__(self, rate_loc=None, unit_select_loc=None):
        self.rate_loc = rate_loc
        self.unit_select_loc = unit_select_loc


def _mkitem(index):
    return RateFormItem(
        (By.CSS_SELECTOR, "input#rate_" + str(index)), Select((By.CSS_SELECTOR, "select#per_time_" + str(index)))
    )


rate_form = Form(
    fields=[
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:31,代码来源:chargeback.py

示例14: make_tree_locator

from cfme.web_ui.menu import nav
from utils.timeutil import parsetime
from utils.update import Updateable
from utils.wait import wait_for, TimedOutError


def make_tree_locator(acc_name, root_name):
    """ Make a specific locator for the tree in accordions.

    Args:
        acc_name: Accordion title
        root_name: Title of the root node of the tree in the accordion.
    """
    return '//span[.="%s"]/../..//table//tr[contains(@title, "%s")]/../..' % (acc_name, root_name)

settings_tree = Tree(make_tree_locator("Settings", "Region"))
access_tree = Tree(make_tree_locator("Access Control", "Region"))
diagnostics_tree = Tree(make_tree_locator("Diagnostics", "Region"))
database_tree = Tree(make_tree_locator("Database", "VMDB"))

server_roles = Form(
    fields=[
        ('ems_metrics_coordinator', "//input[@id='server_roles_ems_metrics_coordinator']"),
        ('ems_operations', "//input[@id='server_roles_ems_operations']"),
        ('ems_metrics_collector', "//input[@id='server_roles_ems_metrics_collector']"),
        ('reporting', "//input[@id='server_roles_reporting']"),
        ('ems_metrics_processor', "//input[@id='server_roles_ems_metrics_processor']"),
        ('scheduler', "//input[@id='server_roles_scheduler']"),
        ('smartproxy', "//input[@id='server_roles_smartproxy']"),
        ('database_operations', "//input[@id='server_roles_database_operations']"),
        ('smartstate', "//input[@id='server_roles_smartstate']"),
开发者ID:kbrock,项目名称:cfme_tests,代码行数:31,代码来源:configuration.py

示例15: Tree

""" A model of Workloads page in CFME
"""

from cfme.web_ui import accordion, menu, Tree


visible_tree = Tree("//div[@class='dhxcont_global_content_area']"
                    "[not(contains(@style, 'display: none'))]/div/div/div"
                    "/ul[@class='dynatree-container']")

menu.nav.add_branch(
    "services_workloads",
    {
        "service_vms_instances":
        [
            lambda _: accordion.tree("VMs & Instances", "All VMs & Instances"),
            {
                "service_vms_instances_filter_folder":
                [
                    lambda ctx: visible_tree.click_path(ctx["folder_name"]),
                    {
                        "service_vms_instances_filter":
                        lambda ctx: visible_tree.click_path(ctx["filter_name"])
                    }
                ]
            }
        ],

        "service_templates_images":
        [
            lambda _: (accordion.tree("Templates & Images", "All Templates & Images")),
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:31,代码来源:workloads.py


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