本文整理汇总了Python中Utils.Config.is_element_present方法的典型用法代码示例。如果您正苦于以下问题:Python Config.is_element_present方法的具体用法?Python Config.is_element_present怎么用?Python Config.is_element_present使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.Config
的用法示例。
在下文中一共展示了Config.is_element_present方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
self.verificationErrors = []
Config.find_element(Config.openSettings).click()
time.sleep(1)
self.user = Config.find_element(Config.settings_email).text
listID = Config.find_element(Config.main_listByName, "Shared").get_attribute("id")
InitCase.init_case(menu=listID, taskNo=1)
CreateLoadedTask.create_loaded_task()
Config.sync()
ChangeUser.change_user(self.other_user())
self.user = self.other_user()
InitCase.init_case(menu="ALL", taskOption="subtasks")
try: self.assertEqual("subtask", Config.find_element(Config.subtasks_title).text)
except AssertionError as e: self.verificationErrors.append(str(e))
InitCase.task_options("note")
try: self.assertTrue(len(Config.find_element(Config.note).text) != 0)
except AssertionError as e: self.verificationErrors.append(str(e))
InitCase.task_options("files")
try: self.assertEqual("2015-03-29.png", Config.find_element(Config.files_name).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.is_element_present(Config.files_thumbnailByType, "image"))
except AssertionError as e: self.verificationErrors.append(str(e))
InitCase.close_task()
try: self.assertTrue(Config.is_element_present(Config.taskPriority))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例2: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
driver = Config.get_driver()
google = None
mainWindow = driver.current_window_handle
self.verificationErrors = []
try: Config.wait_for_element_visibility(Config.singUp_GooglePlusButton, trys=10)
except ElementNotVisibleException:
if not Config.is_element_present(Config.settingsPane):
Config.find_element(Config.openSettings).click()
Config.find_element(Config.settings_profile).click()
Config.find_element(Config.profile_signOut).click()
Config.wait_for_element_visibility(Config.singUp_GooglePlusButton)
Config.find_element(Config.signIn_alreadyMember).click()
Config.wait_for_element(Config.signIn_googlePlus)
Config.find_element(Config.signIn_googlePlus).click()
time.sleep(6)
try: self.assertFalse(Config.is_element_present(Config.signUp_skipWhatsNew))
except AssertionError as e: self.verificationErrors.append(str(e))
Config.wait_for_element(Config.main_hayush)
try: self.assertEqual("HI ANY", Config.find_element(Config.main_hayush).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.profilePic).value_of_css_property("background-image").index("google")
except ValueError as e: self.verificationErrors.append(e)
示例3: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
InitCase.init_case(menu="ALL", taskNo=0)
self.verificationErrors = []
taskID = CreateTaskF.create_a_task("Someday", "Someday")
Config.find_element(Config.taskTitle).click()
Config.find_element(Config.task_recurrence).click()
Config.find_element(Config.recurrenceByType, "DAY").click()
Config.find_element(Config.recurrence_ok).click()
Config.find_element(Config.task_closeButton).click()
time.sleep(1)
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Today"))
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.taskCheck).click()
Config.wait_for_element(Config.taskBySectionName, "Tomorrow")
taskList = Config.find_elements(Config.task)
taskList.remove(Config.find_element(Config.taskByID, taskID))
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Tomorrow"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.find_element(Config.taskRecurringByID, taskList[0].get_attribute("data-task-id")).is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例4: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
driver = Config.get_driver()
facebook = None
mainWindow = driver.current_window_handle
self.verificationErrors = []
try: Config.wait_for_element_visibility(Config.singUp_FacebookButton, trys=10)
except :
if not Config.is_element_present(Config.settingsPane):
Config.find_element(Config.openSettings).click()
Config.find_element(Config.settings_profile).click()
Config.find_element(Config.profile_signOut).click()
Config.wait_for_element_visibility(Config.singUp_FacebookButton)
Config.find_element(Config.singUp_FacebookButton).click()
try:
facebook = driver.window_handles
facebook.remove(mainWindow)
driver.switch_to_window(facebook)
time.sleep(4)
Config.find_element([By.ID, "email"]).clear()
Config.find_element([By.ID, "email"]).send_keys("[email protected]")
Config.find_element([By.ID, "pass"]).clear()
Config.find_element([By.ID, "pass"]).send_keys("mobiitnow1")
Config.find_element([By.ID, "loginbutton"]).click()
except:
raise FacebookError
finally:
driver.switch_to_window(mainWindow)
Config.wait_for_element(Config.main_hayush, trys=10)
try: self.assertEqual("HI RELASE", Config.find_element(Config.main_hayush).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.profilePic).value_of_css_property("background-image").index("facebook")
except ValueError as e: self.verificationErrors.append(e)
示例5: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
self.verificationErrors = []
Config.find_element(Config.openSettings).click()
time.sleep(1)
user = Config.find_element(Config.settings_email).text
InitCase.init_case(menu="ALL", view="date")
sender = Config.get_sender()
receiver = Config.get_receiver()
sections = ["Tomorrow", "Upcoming", "Someday"]
for i in range(3):
sec = random.choice(sections)
ActionChains(Config.get_driver()).drag_and_drop(Config.find_element(Config.task), Config.find_element(Config.list_sectionByName, sec)).perform()
sections.remove(sec)
Config.sync()
if user == receiver: user = sender
else: user = receiver
ChangeUser.change_user(user)
InitCase.init_case(menu="ALL", view="date")
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, sec))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例6: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
Config.find_element(Config.openSettings).click()
time.sleep(1)
self.user = Config.find_element(Config.settings_email).text
listID = Config.find_element(Config.main_listByName, "PERSONAL ERRANDS").get_attribute("id")
SharedListID = Config.find_element(Config.main_listByName, "Shared").get_attribute("id")
InitCase.init_case(menu=listID, taskNo=1, taskOption="open")
self.verificationErrors = []
Config.find_element(Config.task_FolderSelector).click()
Config.find_element(Config.task_ListSelectorItemByID, SharedListID).click()
Config.find_element(Config.confirmDialog_OK).click()
Config.find_element(Config.task_closeButton).click()
Config.sync()
ChangeUser.change_user(self.other_user())
self.user = self.other_user()
Config.find_element(Config.main_listByName, "Shared").click()
try: self.assertTrue(Config.is_element_present(Config.task))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例7: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
d = datetime.datetime.now()
ChangeUser.change_to_premium()
taskID = InitCase.init_case(menu="ALL", taskOption="open", taskNo=1)
self.verificationErrors = []
Config.find_element(Config.task_recurrence).click()
Config.find_element(Config.recurrenceByType, "MONTH").click()
Config.find_element(Config.recurrence_monthlyDayOfWeek).click()
Config.find_element(Config.recurrence_ok).click()
Config.find_element(Config.task_closeButton).click()
time.sleep(1)
Config.find_element(Config.taskCheck).click()
Config.wait_for_element(Config.taskBySectionName, "Upcoming")
taskList = Config.find_elements(Config.task)
taskList.remove(Config.find_element(Config.taskByID, taskID))
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Upcoming"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.find_element(Config.taskRecurringByID, taskList[0].get_attribute("data-task-id")).is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.taskTitleBySectionName, "Upcoming").click()
try: self.assertEqual("Once a month, on the " + self.month_by_day(d), Config.find_element(Config.task_recurrenceLabel).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.task_TimeSelector).text.index(self.next_month_by_day(d))
except ValueError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例8: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
d = datetime.datetime.now()
dy = d.year + 1
y = datetime.datetime(dy, d.month, d.day).strftime("%A %m.%d").replace("0","")
taskID = InitCase.init_case(menu="ALL", taskOption="open", taskNo=1)
self.verificationErrors = []
Config.find_element(Config.task_recurrence).click()
Config.find_element(Config.recurrenceByType, "YEAR").click()
Config.find_element(Config.recurrence_ok).click()
Config.find_element(Config.task_closeButton).click()
time.sleep(1)
Config.find_element(Config.taskCheck).click()
Config.wait_for_element(Config.taskBySectionName, "Upcoming")
taskList = Config.find_elements(Config.task)
taskList.remove(Config.find_element(Config.taskByID, taskID))
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Upcoming"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.find_element(Config.taskRecurringByID, taskList[0].get_attribute("data-task-id")).is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.taskTitleBySectionName, "Upcoming").click()
try: self.assertEqual("Once a year", Config.find_element(Config.task_recurrenceLabel).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.task_TimeSelector).text.index(y)
except IndexError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例9: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
InitCase.init_case(menu="MAIN")
self.verificationErrors = []
listName = "x"
Config.find_element(Config.main_newList).click()
Config.find_element(Config.listTitleEdit).send_keys(listName)
Config.find_element(Config.listTitleEdit).send_keys(Keys.ENTER)
try: Config.is_element_present(Config.main_listByName, listName)
except AssertionError as e: self.verificationErrors.append(str(e))
global listID
listID = Config.find_element(Config.main_listByName, listName).get_attribute("id")
self.assertEqual([], self.verificationErrors)
示例10: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
driver = Config.get_driver()
google = None
mainWindow = driver.current_window_handle
self.verificationErrors = []
try: Config.wait_for_element_visibility(Config.singUp_GooglePlusButton, trys=10)
except ElementNotVisibleException:
if not Config.is_element_present(Config.settingsPane):
Config.find_element(Config.openSettings).click()
Config.find_element(Config.settings_profile).click()
Config.find_element(Config.profile_signOut).click()
Config.wait_for_element_visibility(Config.singUp_GooglePlusButton)
Config.find_element(Config.singUp_GooglePlusButton).click()
try:
google = driver.window_handles
google.remove(mainWindow)
driver.switch_to_window(google)
Config.wait_for_element([By.ID, "Email"])
Config.find_element([By.ID, "Email"]).clear()
Config.find_element([By.ID, "Email"]).send_keys("[email protected]")
if Config.is_element_present([By.ID, "Passwd"]) == False:
Config.find_element([By.ID, "next"]).click()
Config.wait_for_element([By.CSS_SELECTOR, "input#Passwd"])
Config.find_element([By.CSS_SELECTOR, "input#Passwd"]).clear()
Config.find_element([By.CSS_SELECTOR, "input#Passwd"]).send_keys("mobiitnow")
Config.find_element([By.ID, "signIn"]).click()
time.sleep(3)
if Config.is_element_present([By.XPATH, "//button[@id=\"submit_approve_access\"]"]):
Config.wait_for_element([By.XPATH, "//button[@id=\"submit_approve_access\" and @disabled]"], present=False)
Config.find_element([By.ID, "submit_approve_access"]).click()
except NoSuchWindowException:
driver.switch_to_window(mainWindow)
except: self.verificationErrors.append("Google authentication error")
else: driver.switch_to_window(mainWindow)
try:
Config.wait_for_element([By.CSS_SELECTOR, "div#skip.textButton"])
Config.find_element([By.CSS_SELECTOR, "div#skip.textButton"]).click()
except: pass
Config.wait_for_element(Config.main_hayush)
try: self.assertEqual("HI ANY", Config.find_element(Config.main_hayush).text)
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.profilePic).value_of_css_property("background-image").index("google")
except ValueError as e: self.verificationErrors.append(e)
示例11: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
d = datetime.datetime.now()
wx = d.strftime("%a").upper()
days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
selectedDays = []
for i in range(3):
x = random.choice(days)
selectedDays.append(x)
days.remove(x)
ChangeUser.change_to_premium()
taskID = InitCase.init_case(menu="ALL", taskOption="open", taskNo=1)
self.verificationErrors = []
Config.find_element(Config.task_recurrence).click()
Config.find_element(Config.recurrenceByType, "WEEK").click()
for day in selectedDays:
Config.find_element(Config.recurrence_weekdayByName, day).click()
selectedRep = []
for sel in Config.find_elements(Config.recurrence_selectedDays):
selectedRep.append(sel.get_attribute("data-id"))
Config.find_element(Config.recurrence_ok).click()
Config.find_element(Config.task_closeButton).click()
for p in range(len(selectedRep)):
wday = selectedRep[p]
Config.wait_for_element(Config.task_closeButton, present=False)
Config.find_element(Config.taskCheckByStatus, "unchecked").click()
for i in range(20):
try:
if len(Config.find_elements(Config.taskBySectionName, "Upcoming\" or @data-category=\"Tomorrow")) == p+1: break
except: pass
time.sleep(1)
else: raise NoSuchElementException
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Upcoming\" or @data-category=\"Tomorrow"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.find_element(Config.taskRecurringByStatus, "unchecked").is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.taskTitleByStatus, "unchecked").click()
try: Config.find_element(Config.task_recurrenceLabel).text.index(wday.capitalize())
except ValueError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.task_TimeSelector).text.index(self.next_weekday(selectedRep, p))
except ValueError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.task_closeButton).click()
self.assertEqual([], self.verificationErrors)
示例12: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
InitCase.init_case(menu="ALL", view="priority", taskNo=0)
self.verificationErrors = []
CreateTaskF.create_a_task("priHigh", "High")
try: self.assertTrue(Config.is_element_present(Config.taskPriority))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例13: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
InitCase.init_case(menu="ALL", taskOption="files")
self.verificationErrors = []
Config.find_element(Config.files_addFromComputer).send_keys("C:\\Users\\Eidan Wasser\\PycharmProjects\\Suite1\\Files\\audio.m4a")
Config.wait_for_element(Config.files_progressBar, present=False)
try: self.assertTrue(Config.is_element_present(Config.files_thumbnailByType, "audio"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.is_element_present([By.CSS_SELECTOR, "audio"]))
except AssertionError as e: self.verificationErrors.append(str(e))
#Check files badge = 1
try: self.assertEqual("1", Config.find_element(Config.task_badgeByIconName, "files").get_attribute("data-badge"))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例14: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
d = datetime.datetime.now()
X = random.choice(range(1,10))
Y = random.choice(range(1,4))
ChangeUser.change_to_premium()
taskID = InitCase.init_case(menu="ALL", taskOption="open", taskNo=1)
self.verificationErrors = []
Config.find_element(Config.task_recurrence).click()
Config.find_element(Config.recurrenceByType, "DAY").click()
for t in range(X): Config.find_element(Config.recurrence_everyXPlus).click()
Config.find_element(Config.recurrence_endsAfter).click()
for q in range(Y): Config.find_element(Config.recurrence_endsAfterYPlus).click()
Config.find_element(Config.recurrence_ok).click()
Config.find_element(Config.task_closeButton).click()
for h in range(Y):
d = d + datetime.timedelta(X+1)
dText = d.strftime("%A %m.%d").replace("0","")
Config.wait_for_element(Config.task_closeButton, present=False)
Config.find_element(Config.taskCheckByStatus, "unchecked").click()
for i in range(20):
try:
if len(Config.find_elements(Config.taskBySectionName, "Upcoming")) == h+1: break
except: pass
time.sleep(1)
else: raise NoSuchElementException
try: self.assertTrue(Config.is_element_present(Config.taskBySectionName, "Upcoming"))
except AssertionError as e: self.verificationErrors.append(str(e))
try: self.assertTrue(Config.find_element(Config.taskRecurringByStatus, "unchecked").is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.taskTitleByStatus, "unchecked").click()
try: self.assertEqual(Config.find_element(Config.task_recurrenceLabel).text, "Every " + str(X+1) + " days, Ends after " + str(Y+1) + " times")
except AssertionError as e: self.verificationErrors.append(str(e))
try: Config.find_element(Config.task_TimeSelector).text.index(dText)
except ValueError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.task_closeButton).click()
Config.find_element(Config.taskCheckByStatus, "unchecked").click()
time.sleep(3)
try: self.assertEqual(len(Config.find_elements(Config.task)), Y+1)
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例15: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import is_element_present [as 别名]
def test(self):
InitCase.init_case(menu="ALL", taskNo=0)
self.verificationErrors = []
try: self.assertFalse(Config.is_element_present(Config.task))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)