本文整理汇总了Python中selenium.webdriver.support.wait.WebDriverWait.find_element_by_class_name方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.find_element_by_class_name方法的具体用法?Python WebDriverWait.find_element_by_class_name怎么用?Python WebDriverWait.find_element_by_class_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.wait.WebDriverWait
的用法示例。
在下文中一共展示了WebDriverWait.find_element_by_class_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create2
# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import find_element_by_class_name [as 别名]
def create2(self, screen_name, items_to_test, finder, just_headers=False):
self.gui_lib.navigate_to_screen(screen_name)
# time.sleep(5)
# self.driver.execute_script("document.getElementById('tableWidget1_3_mapping').innerHTML=\"\";")
values = []
for item in items_to_test:
try:
label_name = WebDriverWait(self.driver, 30).until(finder.find_label(item))
if not just_headers:
vals = finder.find_values(label_name)
values.append(vals)
else:
label = label_name.find_element_by_class_name('syslog_heading')
self.test_helper.assert_true(len(label.text) == 0,
'Expected ' + label.text + ' to be > 0, but was ' + str(
len(label.text)),
'Ensure ' + label.text + ' is displayed.')
except TimeoutException:
self.test_helper.assert_true(True,
'Expected ' + item + ' but TimeoutException occurred.',
'Ensure ' + item + ' is displayed.')
break
for idx, row in enumerate(values):
name = items_to_test[idx]
self.test_helper.assert_true(len(name) == 0, 'Expected ' + name + ' to be > 0 but was ' + str(
len(name)), 'Ensure ' + name + ' visible.')
for td in row:
self.test_helper.assert_true(len(td) == 0,
'Expected ' + td + ' to be > 0 but was ' + str(
len(td)),
'Ensure ' + name + ' data visible.')