本文整理汇总了Python中robot.libraries.BuiltIn.BuiltIn._get_text方法的典型用法代码示例。如果您正苦于以下问题:Python BuiltIn._get_text方法的具体用法?Python BuiltIn._get_text怎么用?Python BuiltIn._get_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robot.libraries.BuiltIn.BuiltIn
的用法示例。
在下文中一共展示了BuiltIn._get_text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: table_get_column_no
# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _get_text [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_table_cell_value
# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _get_text [as 别名]
def get_table_cell_value(self, table_locator, rowNo, colName):
"Returns the text located in the table 'table_locator' with in the Column 'columnName' and matching Row 'iRowNo'" ""
selenium = BuiltIn().get_library_instance("Selenium2Library")
colNo = self.table_get_column_no(table_locator, colName)
return selenium._get_text(
table_locator
+ '/div[@class="dgrid-scroller"]/div[contains(@class,"dgrid-content")]//div[contains(@id,"-row")]['
+ str(rowNo)
+ ']/table/tr/td[contains(@class,"dgrid-cell")]['
+ str(colNo)
+ "]"
)
示例3: get_table_values_into_list
# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import _get_text [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