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


Python BuiltIn.get_matching_xpath_count方法代码示例

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


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

示例1: table_get_column_no

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import get_matching_xpath_count [as 别名]
 def table_get_column_no(self, table_locator, columnName):
     """Returns the column number of the column matching 'columnName' from the table located at 'table_locator'."""
     #try:
     selenium = BuiltIn().get_library_instance('Selenium2Library')
     colCount = int(selenium.get_matching_xpath_count(table_locator+'/div[contains(@class,"dgrid-header dgrid-header-row")]/table[contains(@id,"-header")]/tr/th'))
     print "colCount:"+str(colCount)
     for iCounter in range(1,colCount+1):
         curColName = selenium._get_text(table_locator+'//div[contains(@class,"dgrid-header dgrid-header-row")]/table[contains(@id,"-header")]/tr/th['+str(iCounter)+']')
         if (curColName.replace(' ','').strip().lower()==columnName.replace(' ','').strip().lower()):
             print "column name matched at "+str(iCounter)
             return iCounter
     return 0
开发者ID:Tenxlabsmm,项目名称:Demo,代码行数:14,代码来源:CommonLibrary.py

示例2: _get_element_index

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import get_matching_xpath_count [as 别名]
 def _get_element_index(self,locator,expected):
     """Returns index of the element at which the 'expected' value found """
     selenium = BuiltIn().get_library_instance('Selenium2Library')
     elements = selenium.get_matching_xpath_count(locator)
     for ele in range(int(elements)):
         newelements = selenium._element_find(locator,False,False)
         actual = newelements[ele].text
         if expected in actual:
             print "header:"+str(newelements[ele].text)
             print 'matched at'+str(ele+1)
             return ele+1
     else:
         return 0
开发者ID:Tenxlabsmm,项目名称:Demo,代码行数:15,代码来源:CommonLibrary.py

示例3: get_table_values_into_list

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import get_matching_xpath_count [as 别名]
 def get_table_values_into_list(self, locator, columnName):
     """Returns the list of values displayed under 'columnName' from the table located at 'locator' """
     selenium = BuiltIn().get_library_instance('Selenium2Library')
     #Get the column number
     iColNo = self.table_get_column_no(locator,columnName)
     #Get the Number of Records in the Table
     elements = selenium.get_matching_xpath_count(locator+'/div[@class="dgrid-scroller"]/div[contains(@class,"dgrid-content")]//div[contains(@id,"-row")]')
     print "elements:"+str(elements)
     rowValues = []
     #Get the values from the records
     for ele in range(1,int(elements)+1):
         cellValue = selenium._get_text(locator+'/div[@class="dgrid-scroller"]/div[contains(@class,"dgrid-content")]//div[contains(@id,"-row")]['+str(ele)+']/table/tr/td[contains(@class,"dgrid-cell")]['+str(iColNo)+']')
         rowValues.append(cellValue)
     return rowValues                 
开发者ID:Tenxlabsmm,项目名称:Demo,代码行数:16,代码来源:CommonLibrary.py


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