本文整理汇总了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
示例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
示例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