本文整理汇总了Python中Utils.Config.get_driver方法的典型用法代码示例。如果您正苦于以下问题:Python Config.get_driver方法的具体用法?Python Config.get_driver怎么用?Python Config.get_driver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.Config
的用法示例。
在下文中一共展示了Config.get_driver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
InitCase.init_case(menu="MAIN")
self.verificationErrors = []
listID = NewList.listID
list = Config.find_element(Config.main_listByID, listID)
allTasks = Config.find_element(Config.main_AllTasks)
#~Drag and Drop~
ActionChains(Config.get_driver()).click_and_hold(list).perform()
time.sleep(0.5)
ActionChains(Config.get_driver()).move_to_element_with_offset(allTasks, 238, 0).perform()
time.sleep(0.5)
ActionChains(Config.get_driver()).release().perform()
time.sleep(1)
style = list.get_attribute("style")
left = style.find("left: ") + 6
position = ""
for i in range(3):
position = position + style[left]
left = left + 1
try: self.assertEqual("238", position)
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例2: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
driver = Config.get_driver()
InitCase.init_case(menu="MAIN")
self.verificationErrors = []
lists = Config.find_elements(Config.main_list)
for l in lists:
if l.get_attribute("id") in ["pre_all_tasks", "new"]: lists.remove(l)
listsToAdd = range(4-len(lists))
for lst in listsToAdd:
Config.find_element(Config.main_newList).click()
Config.find_element(Config.listTitleEdit).send_keys(str(lst))
Config.find_element(Config.listTitleEdit).send_keys(Keys.ENTER)
lists.append(Config.find_element(Config.main_listByName, str(lst)))
allTasks = Config.find_element(Config.main_AllTasks)
for i in range(3):
ActionChains(Config.get_driver()).click_and_hold(random.choice(lists)).perform()
time.sleep(0.5)
ActionChains(Config.get_driver()).move_to_element_with_offset(allTasks, 238, 0).perform()
time.sleep(0.5)
ActionChains(Config.get_driver()).release().perform()
time.sleep(1)
listPositions = {}
for li in lists:
listPositions[li.get_attribute("id")] = self.get_position(li)
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="MAIN")
window2Lists = Config.find_elements(Config.main_list)
for ls in window2Lists:
if ls.get_attribute("id") in ["pre_all_tasks", "new"]: window2Lists.remove(ls)
for lt in window2Lists:
try: self.assertEqual(self.get_position(lt), listPositions[lt.get_attribute("id")])
except AssertionError as e: self.verificationErrors.append(e)
driver.close()
driver.switch_to_window(mainWindow)
self.assertEqual([], self.verificationErrors)
示例3: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [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)
示例4: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [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 get_driver [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)
示例6: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [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="clean", 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()
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="ALL", 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)
示例7: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
taskID = InitCase.init_case(menu="ALL", view="priority")
self.verificationErrors = []
ActionChains(Config.get_driver()).drag_and_drop(Config.find_element(Config.taskByID, taskID), Config.find_element(Config.list_sectionByName, "Normal")).perform()
try: self.assertFalse(Config.is_element_present(Config.taskPriority))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例8: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
taskID = InitCase.init_case(menu="ALL", view="date")
self.verificationErrors = []
ActionChains(Config.get_driver()).drag_and_drop(Config.find_element(Config.taskByID, taskID), Config.find_element(Config.list_sectionByName, "Someday")).perform()
Config.find_element(Config.taskTitleID, taskID).click()
try: Config.find_element(Config.task_TimeSelector).text.index("Someday")
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.task_closeButton).click()
self.assertEqual([], self.verificationErrors)
示例9: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
InitCase.init_case(menu="MAIN")
self.verificationErrors = []
listID = NewList.listID
ActionChains(Config.get_driver()).move_to_element(Config.find_element(Config.main_listByID, listID)).perform()
time.sleep(1)
Config.find_element(Config.main_listOptionsID, listID).click()
Config.find_element(Config.main_listDeleteID, listID).click()
time.sleep(1)
Config.find_element(Config.listDeleteConfirm).click()
try: self.assertFalse(Config.is_element_present(Config.main_listByID, listID))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例10: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
InitCase.init_case(menu="ALL", taskOption="files")
driver = Config.get_driver()
mainWindow = driver.current_window_handle
self.verificationErrors = []
Config.find_element(Config.files_dropbox).click()
try:
dropbox = driver.window_handles
dropbox.remove(mainWindow)
driver.switch_to_window(dropbox)
Config.find_element([By.XPATH, "//input[@name='login_email']"]).clear()
Config.find_element([By.XPATH, "//input[@name='login_email']"]).send_keys("[email protected]")
Config.find_element([By.XPATH, "//input[@name='login_password']"]).clear()
Config.find_element([By.XPATH, "//input[@name='login_password']"]).send_keys("itayoni")
Config.find_element([By.CSS_SELECTOR, "button.login-button.button-primary"]).click()
Config.wait_for_element([By.CSS_SELECTOR, "div.dropbox-personal"])
Config.find_element([By.CSS_SELECTOR, "div.dropbox-personal"]).click()
Config.wait_for_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users\"]"])
Config.find_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users\"]"]).click()
Config.wait_for_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users/Selenium\"]"])
Config.find_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users/Selenium\"]"]).click()
Config.wait_for_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users/Selenium/pic.png\"]"])
Config.find_element([By.XPATH, "//ul[@id='browse-file-list-personal']/li[@data-fqpath=\"/Users/Selenium/pic.png\"]"]).click()
Config.find_element([By.ID, "select-btn"]).click()
except:
raise DropboxError
finally:
driver.switch_to.window(mainWindow)
try: self.assertEqual("pic.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))
#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)
#delete the file
Config.find_element(Config.files_delete).click()
Config.find_element(Config.files_deleteConfirm).click()
time.sleep(3)
示例11: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
self.verificationErrors = []
Config.find_element(Config.openSettings).click()
time.sleep(1)
self.user = Config.find_element(Config.settings_email).text
InitCase.init_case(menu="ALL", taskNo=0)
InitCase.init_case(menu="ALL", view="date", taskOption="share")
Config.find_element(Config.sharing_inputEmail).clear()
Config.find_element(Config.sharing_inputEmail).send_keys(self.other_user())
Config.wait_for_element(Config.sharing_inputEmailDone)
time.sleep(1)
Config.find_element(Config.sharing_commitEmailButton).click()
Config.wait_for_element(Config.sharing_sendInvites)
Config.find_element(Config.sharing_sendInvites).click()
Config.wait_for_element(Config.sharing_inviteOverlay, present=False)
ChangeUser.change_user(self.other_user())
self.user = self.other_user()
Config.wait_for_element(Config.sharingInvitation)
try: self.assertEqual(Config.find_element(Config.sharingInvitation_title).text, "SHARED TASK")
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.sharingInvitation_decline).click()
Config.sync()
InitCase.select_menu("ALL")
try: self.assertFalse(Config.find_element(Config.taskShare).is_displayed())
except AssertionError as e: self.verificationErrors.append(str(e))
ChangeUser.change_user(self.other_user())
self.user = self.other_user()
InitCase.init_case(menu="ALL", taskOption="share")
try: self.assertEqual(Config.find_element(Config.sharing_memberBadgeByEmail, self.other_user()).get_attribute("data-status"), "REJECTED")
except AssertionError as e: self.verificationErrors.append(e)
Config.find_element(Config.sharing_memberBadgeByEmail, self.other_user()).click()
ActionChains(Config.get_driver()).move_to_element(Config.find_element(Config.sharing_memberPopup)).perform()
try: self.assertEqual(Config.find_element(Config.sharing_badgeStatus).text, "Rejected Invitation")
except AssertionError as e: self.verificationErrors.append(e)
self.assertEqual([], self.verificationErrors)
示例12: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
InitCase.init_case(menu="ALL", taskOption="subtasks")
self.verificationErrors = []
ActionChains(Config.get_driver()).move_to_element(Config.find_element(Config.subtask)).perform()
time.sleep(1)
Config.find_element(Config.subtasks_check).click()
time.sleep(1)
#Check badge
try: self.assertEqual("0", Config.find_element(Config.task_badgeByIconName, "subtasks").get_attribute("data-badge"))
except AssertionError as e: self.verificationErrors.append(str(e))
#Check task status
try: self.assertEqual("checked", Config.find_element(Config.subtask).get_attribute("data-status"))
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual([], self.verificationErrors)
示例13: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [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)
示例14: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [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)
示例15: test
# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import get_driver [as 别名]
def test(self):
self.verificationErrors = []
taskID = InitCase.init_case(menu="ALL", view="date", taskOption="open", taskNo=1)
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)
ActionChains(Config.get_driver()).drag_and_drop(Config.find_element(Config.taskByID, taskID), Config.find_element(Config.list_sectionByName, "Someday")).perform()
Config.find_element(Config.taskTitleID, taskID).click()
try: self.assertEqual("", Config.find_element(Config.task_recurrenceLabel).text)
except AssertionError as e: self.verificationErrors.append(str(e))
Config.find_element(Config.task_closeButton).click()
self.assertEqual([], self.verificationErrors)