本文整理匯總了Python中Utils.Config.wait_for_element方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.wait_for_element方法的具體用法?Python Config.wait_for_element怎麽用?Python Config.wait_for_element使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Utils.Config
的用法示例。
在下文中一共展示了Config.wait_for_element方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [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)
示例2: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [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 wait_for_element [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 wait_for_element [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 wait_for_element [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)
示例6: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [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)
示例7: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [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)
示例8: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
taskID = InitCase.init_case(menu="ALL", view="priority", taskOption="open")
self.verificationErrors = []
Config.wait_for_element(Config.task_PrioritySelector)
Config.find_element(Config.task_PrioritySelector).click()
time.sleep(2)
Config.find_element(Config.task_closeButton).click()
Config.wait_for_element(Config.task_closeButton, present=False)
try: self.assertEqual(Config.find_element(Config.taskBySectionName, "High").get_attribute("data-task-id"),taskID)
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例9: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
InitCase.init_case(menu="ALL", taskOption="open")
self.verificationErrors = []
Config.wait_for_element(Config.task_PrioritySelector)
Config.find_element(Config.task_PrioritySelector).click()
time.sleep(2)
Config.find_element(Config.task_closeButton).click()
Config.wait_for_element(Config.task_closeButton, present=False)
try: self.assertTrue(Config.is_element_present(Config.taskPriority))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例10: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
InitCase.init_case(menu="ALL", taskNo=0)
self.verificationErrors = []
Config.find_element(Config.openSettings).click()
Config.wait_for_element(Config.settings_preferences)
Config.find_element(Config.settings_preferences).click()
Config.wait_for_element(Config.preferences_defaultList)
Config.find_element(Config.preferences_defaultList).click()
Config.wait_for_element(Config.defaultList_changeDefault)
newDefaultName = Config.find_element(Config.defaultList_changeDefault).text
Config.find_element(Config.defaultList_changeDefault).click()
Config.find_element(Config.overlay).click()
Config.wait_for_element_visibility(Config.overlay, visible=False)
CreateTaskF.create_a_task("def")
Config.find_element(Config.taskTitle).click()
Config.wait_for_element(Config.task_FolderSelector)
try: self.assertEqual(Config.find_element(Config.task_FolderSelector).text, newDefaultName)
except AssertionError as e: self.verificationErrors.append(e)
self.assertEqual([], self.verificationErrors)
示例11: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
self.verificationErrors = []
ChangeUser.change_user("[email protected]")
time.sleep(5)
try: self.assertFalse(Config.is_element_present(Config.signUp_start))
except AssertionError as e: self.verificationErrors.append(e)
Config.wait_for_element(Config.main_hayush)
try: self.assertEqual(Config.find_element(Config.main_hayush).text, "HI AUTLOGIN")
except AssertionError as e: self.verificationErrors.append(e)
Config.find_element(Config.openSettings).click()
time.sleep(1)
try: self.assertEqual(Config.find_element(Config.settings_email).text, "[email protected]")
except AssertionError as e: self.verificationErrors.append(e)
示例12: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
driver = Config.get_driver()
self.verificationErrors = []
listID = Config.find_element(Config.main_listByName, "POS").get_attribute("id")
taskIDs = InitCase.init_case(menu=listID, view="date", taskNo=5)
for i in range(3):
n = Config.find_element(Config.taskTitleID, random.choice(taskIDs))
ActionChains(driver).drag_and_drop_by_offset(n, 0, 90).perform()
Config.find_element(Config.taskTitleID, random.choice(taskIDs)).click()
Config.wait_for_element(Config.task_TimeSelector)
Config.find_element(Config.task_TimeSelector).click()
selectDay = self.select_day(Config.find_element(Config.cal_selectedDay).get_attribute("data-full"))
Config.find_element(Config.cal_dayByDate, selectDay).click()
Config.find_element(Config.cal_OK).click()
Config.find_element(Config.task_closeButton).click()
Config.wait_for_element(Config.task_closeButton, present=False)
ActionChains(driver).drag_and_drop(Config.find_element(Config.taskTitleBySectionName, "Today"), Config.find_element(Config.list_sectionByName, "Upcoming")).perform()
InitCase.select_view("clean")
newOrder = Config.find_elements(Config.task)
newOrderIDs = []
for t in newOrder:
newOrderIDs.append(t.get_attribute("data-task-id"))
mainWindow = driver.current_window_handle
driver.execute_script("$(window.open())")
window2 = driver.window_handles
window2.remove(mainWindow)
driver.switch_to_window(window2)
driver.get(Config.get_base_url())
InitCase.init_case(menu=listID, view="clean", taskNo=5)
platform2Order = Config.find_elements(Config.task)
for t in range(len(platform2Order)):
try: self.assertEqual(platform2Order[t].get_attribute("data-task-id"), newOrderIDs[t])
except AssertionError as e: self.verificationErrors.append(str(e))
driver.close()
driver.switch_to_window(mainWindow)
示例13: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [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)
示例14: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
InitCase.init_case(menu="ALL", taskNo=1, taskOption="open")
self.verificationErrors = []
Config.wait_for_element(Config.task_editTitle)
Config.find_element(Config.task_editTitle).clear()
Config.find_element(Config.task_editTitle).send_keys("edited")
time.sleep(1)
Config.find_element(Config.task_closeButton).click()
Config.wait_for_element(Config.task_closeButton, present=False)
try: self.assertEqual("edited", Config.find_element(Config.taskTitle).text)
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例15: test
# 需要導入模塊: from Utils import Config [as 別名]
# 或者: from Utils.Config import wait_for_element [as 別名]
def test(self):
InitCase.init_case(taskOption="note")
self.verificationErrors = []
noteText = "edit edit edit edit"
Config.find_element(Config.note).clear()
Config.find_element(Config.note).send_keys(noteText)
try: self.assertEqual(" ", Config.find_element(Config.task_badgeByIconName, "note").get_attribute("data-badge"))
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.task_closeButton).click()
Config.wait_for_element(Config.task_closeButton, present=False)
InitCase.task_options("note")
time.sleep(1)
try: self.assertEqual(noteText, Config.find_element(Config.note).text)
except AssertionError as e: self.verificationErrors.append(str(e))