本文整理汇总了Python中Common.Utils.PD_DebugLog类的典型用法代码示例。如果您正苦于以下问题:Python PD_DebugLog类的具体用法?Python PD_DebugLog怎么用?Python PD_DebugLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PD_DebugLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_if_platform_ip_existing
def check_if_platform_ip_existing(self, driver, platform_ip, platform_name):
'''
To get platform node from the web page
And enter into the page, and get the elements info.
'''
cur_platform_ip = ''
cur_platform_name = ''
default_main_browser = Main_Browser_UIMap(driver)
subtree = default_main_browser.get_platform_sub_menu_tree()
platform_subtree = Platform_Tree(driver, subtree)
count = platform_subtree.get_platform_count()
for index in range(count):
#elem = platform_subtree.get_platform_item(index) #platformNode.switch_to_page()
platform_subtree.enter_platform_summary_page(index)
# elem.click() # switch into the platform tree node
# elem_page_driver = Platform_Summary_UIMap(default_main_browser)
cur_platform_name = platform_subtree.get_platform_name(index)
cur_platform_ip = platform_subtree.get_platform_ip() #index
if platform_name == cur_platform_name:
break
PD_DebugLog.debug_print("")
if platform_ip != cur_platform_ip or platform_name != cur_platform_name:
return False
else:
return True
示例2: wait_for
def wait_for(func, timeout, first=0.0, step=1.0, text=None):
"""
If func() evaluates to True before timeout expires, return the
value of func(). Otherwise return None.
@brief: Wait until func() evaluates to True.
:param timeout: Timeout in seconds
:param first: Time to sleep before first attempt
:param steps: Time to sleep between attempts in seconds
:param text: Text to print while waiting, for debug purposes
"""
start_time = time.time()
end_time = time.time() + timeout
time.sleep(first)
while time.time() < end_time:
if text:
PD_DebugLog.debug_print("%s (%f secs)" % ( text, (time.time() - start_time)))
output = func()
if output:
return output
time.sleep(step)
return None
示例3: save_screenshot
def save_screenshot(driver, path, filename):
'''
To save the screenshot for the failed case
'''
screenshot_filename = os.path.join(path, filename)
PD_DebugLog.debug_print("The saved file is " + screenshot_filename)
driver.save_screenshot(screenshot_filename)
示例4: get_platform_ip
def get_platform_ip(self):
'''Get the platform ip from the ip page '''
ip_text = ''
if self.platform_summary:
ip_text = self.platform_summary.get_platform_ip()
if PD_DebugLog.DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The IP text is: " + ip_text)
return ip_text
示例5: get_submenu_tree
def get_submenu_tree(self, submenu_idx):
##platform_tree //*[@id="pane"]/div[1]
# //*[@id="pane"]/div[1]/ul/li
left_panel = self.driver.find_element(By.ID, Submenu_Tree.LeftPanelID)
xpath = '//div[%d]/ul/li/ul' % (submenu_idx)
submenu = left_panel.find_element(By.XPATH, xpath)
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The sub menu text is: " + submenu.text)
return submenu
示例6: get_submenu_tree_id
def get_submenu_tree_id(self):
#ul_elm = self.tree.find_element(By.XPATH, '//li/ul')
#if DEBUG_LOG_PRINT:
# PD_DebugLog.debug_print("The sub tree is: " + ul_elm.text)
id_attr = self.tree.get_attribute('id')
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The tree id is: " + id_attr)
return id_attr
示例7: get_vm_static_label_text
def get_vm_static_label_text(self, label_xpath):
"""
get the static label text
"""
self._common_enter_summary_frame_proc()
elem = self.driver.find_element(By.XPATH, label_xpath)
text = elem.text
PD_DebugLog.debug_print("Get the element title: " + elem.text)
self._common_exit_summary_frame_proc()
return text
示例8: is_closed
def is_closed(self):
# check if the switch is closed
xpath = '//*[@id="%s"]/span' % self.get_current_node_id()
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print(self.__class__.__name__ + "The xpath is : " + xpath)
elem = self.node.find_element(By.XPATH, xpath)
attr = elem.get_attribute('class')
node_closed = attr.endwith('_close')
return node_closed
示例9: readconfig
def readconfig(classname):
config = ConfigParser.ConfigParser()
config_file = 'cfg\\' + classname + '.cfg'
PD_DebugLog.debug_print("The self.config_file is " + config_file)
config_file = os.path.join(Basejob.TESTCASE_DIR, config_file)
PD_DebugLog.debug_print("The self.config_file is " + config_file)
if config_file and os.path.exists(config_file):
config.read(config_file)
return config
else:
return None
示例10: get_all_child_nodes
def get_all_child_nodes(self):
xpath = '//*[@id="%s"]/li' % self.get_current_node_id()
if self.has_child_node():
xpath = '//*[@id="%s"]/ul/li' % self.get_current_node_id()
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print(self.__class__.__name__ + ":" + \
"get_all_child_nodes" + \
"The xpath is : " + xpath)
elemts = self.node.find_elements(By.XPATH, xpath)
return elemts
示例11: get_loss_ratio
def get_loss_ratio(output):
"""
Get the packet loss ratio from the output of ping.
:param output: Ping output.
"""
try:
# packet loss
return int(re.findall(u'(\d+)% 丢失', output)[0])
except IndexError:
PD_DebugLog.debug_print(output)
return -1
示例12: get_task_count
def get_task_count(self):
'''
get the task table element
'''
summary_text = self.get_task_summary()
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("Summary text is: " + summary_text)
ptn = re.compile(r'\d+')
result = re.findall(ptn, summary_text)
count = result[0]
if DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The count in summary is: " + count)
return count
示例13: is_tab_current_selected
def is_tab_current_selected(self, tab_idx):
'''
return bool value to represent whether the tab is current selected
'''
cur_selected = False
tab_elm = self.get_tab_from_leftpanel(tab_idx)
attr = tab_elm.get_attribute('class')
if PD_DebugLog.DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The current tab attribute is: " + attr)
if 'current' == attr:
cur_selected = True
return cur_selected
示例14: get_tab_from_leftpanel
def get_tab_from_leftpanel(self, tab_idx):
'''
get the tab element for platform resource
'''
# //*[@id="tab"]/li[2]/a
tab = self.driver.find_element(By.XPATH, '//*[@id="tab"]/li[%d]/a' % tab_idx )
#tab = tab_elemts.find_elements(By.XPATH, '//li[%d]' % (tab_idx))
#xpath_ptn = '//li[%d]' % (tab_idx)
# /html/body/div[2]/div/ul/li[4]
# tab_elmt = ta#tab_elemts[tab_idx-1]
if PD_DebugLog.DEBUG_LOG_PRINT:
PD_DebugLog.debug_print("The tab text is: " + tab.text)
return tab
示例15: get_platform_name
def get_platform_name(self):
'''
get the platform name
'''
self._common_enter_summary_frame_proc()
# /html/body/div/fieldset/legend
xpath = '/html/body/div/fieldset/legend'
elem = self.driver.find_element(By.XPATH, xpath)
text = elem.text
PD_DebugLog.debug_print("Get the element title: " + elem.text)
self._common_exit_summary_frame_proc()
return text