当前位置: 首页>>代码示例>>Python>>正文


Python Config.find_elements方法代码示例

本文整理汇总了Python中Utils.Config.find_elements方法的典型用法代码示例。如果您正苦于以下问题:Python Config.find_elements方法的具体用法?Python Config.find_elements怎么用?Python Config.find_elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils.Config的用法示例。


在下文中一共展示了Config.find_elements方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:34,代码来源:ListViewALL.py

示例2: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:60,代码来源:WeeklyPremium.py

示例3: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:59,代码来源:XDays.py

示例4: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:50,代码来源:MainGrid.py

示例5: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:35,代码来源:Yearly.py

示例6: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:29,代码来源:SomedayToRecurring.py

示例7: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:35,代码来源:MonthlyPremium.py

示例8: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [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)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:49,代码来源:DateView.py

示例9: test

# 需要导入模块: from Utils import Config [as 别名]
# 或者: from Utils.Config import find_elements [as 别名]
    def test(self):
        d = datetime.datetime.now()
        dw = d + datetime.timedelta(7)
        w = dw.strftime("%A %m.%d")
        n=""
        for i in range(len(w)):
            if w[i] != "0":
                n = n + w[i]

        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()
        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 week, on " + d.strftime("%A"), 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(n)
        except IndexError as e: self.verificationErrors.append(str(e))

        self.assertEqual([], self.verificationErrors)
开发者ID:eidan76,项目名称:Web-Automation1,代码行数:40,代码来源:Weekly.py


注:本文中的Utils.Config.find_elements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。