class CarDetails:
    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(self.driver, 15)

        # page_objects
        self.helper = Helper(self.driver)

    def select_car_details(self):
        self.wait.until(self.card_to_be_clickable())
        self.select_car_usage('Commute to school').click()
        self.select_car_usage('Rideshare Driver').click()
        self.select_distance_each_way(10).click()
        self.select_payment_status('lean').click()
        self.select_deductible('full_coverage').click()
        self.save_and_continue_button().click()

    @staticmethod
    def assert_car_detail_form():
        return EC.presence_of_element_located(
            (By.CSS_SELECTOR, 'form[id="car_details_form"]'))

    def select_car_usage(self, car_used_for):
        car_usage = self.driver.find_elements_by_css_selector(
            '.absolute-checkbox span')
        for usage in car_usage:
            if usage.text == car_used_for:
                return usage

    def select_distance_each_way(self, value):
        distance = self.driver.find_element_by_css_selector(
            '.btn-group > label[data-field="mileage_per_day"]:nth-of-type(' +
            str(int(value / 5)) + ')')
        return distance

    @staticmethod
    def card_to_be_clickable():
        usage_assertion = EC.element_to_be_clickable(
            (By.CSS_SELECTOR, 'a[id="used_for_work"]'))
        return usage_assertion

    def select_payment_status(self, payment):
        payment_status = self.driver.find_element_by_css_selector(
            'label[for="car_details_payment_status_' + payment + '_radio"]')
        return payment_status

    def select_deductible(self, deductible_type):
        self.helper.assert_for_presence_of_element(
            'label[data-field="deductibles"]:nth-child(1)')
        deductible = self.driver.find_element_by_css_selector(
            'label[data-analytics-label="' + deductible_type + '"]')
        return deductible

    def save_and_continue_button(self):
        self.helper.assert_for_element_to_be_clickable(
            'button[id="car_details_continue_to_driver"]')
        move_to_driver_button = self.driver.find_element_by_css_selector(
            'button[id="car_details_continue_to_driver"]')
        return move_to_driver_button
    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(self.driver, 15)

        # page_objects
        self.helper = Helper(self.driver)
示例#3
0
 def __init__(self, driver):
     self.driver = driver
     self.wait = WebDriverWait(self.driver, 15)
     self.helper = Helper(self.driver)
示例#4
0
        ]
        to_be_deleted = []
        for i in cams.keys():
            if i not in constants.cams_in_use:
                to_be_deleted.append(i)
        for i in to_be_deleted:
            del cams[i]

    # pre-process for the grabbed frames
    for i in constants.cams_in_use:
        if grabbed[i]:
            frames[i] = imutils.resize(frames[i], width=640)
            frames[i] = cv2.flip(frames[i], 1)
            if helper is None:
                h, w, _ = frames[i].shape
                helper = Helper(width=w, height=h)
    if not init:
        # initialize the ordered dicts in the constants module
        constants.initialize()
        # initialize the centroid tracker
        constants.ct.initialize()
        init = True
    # register the recognized staffs and show their bounding boxes
    helper.show_recognized_faces(frames)

    # show on the screen yolo bounding boxes that are generated by the pre-trained yolo head model
    helper.show_yolo_bboxes(frames)

    # track staffs by using detected faces and detected heads centroids
    helper.track()