Ejemplo n.º 1
0
    def type_header(self, header, index=None):
        if index is None:
            index = 1

        self.open_more_options_menu(index)

        vals = header.values()
        keys = header.keys()
        length = len(vals)

        count = BasePage.count_elements(self, By.CSS_SELECTOR, self.row_number_prefix.format(index) +
                                        self.header_name_field)
        while count <= length:
            self.add_header_row(index)
            count += 1

        i = 0
        while i < len(vals):
            name = BasePage.find_element(self, By.CSS_SELECTOR, self.row_header_prefix.format(index, i + 1) +
                                         self.header_name_field)
            value = BasePage.find_element(self, By.CSS_SELECTOR, self.row_header_prefix.format(index, i + 1) +
                                          self.header_value_field)
            BasePage.type(self, keys[i], name)
            BasePage.type(self, vals[i], value)
            i += 1
Ejemplo n.º 2
0
    def upload(self, file_path):
        elem = BasePage.find_element(self, By.CSS_SELECTOR, 'div.files-container input')
        get_driver(self).execute_script("arguments[0].className = 'file-input';", elem)
        get_driver(self).execute_script("arguments[0].style.visibility = 'visible';", elem)
        elem.send_keys([file_path])

        assert BasePage.is_element_present(self, By.CSS_SELECTOR, self.delete_button), 'Failed to upload file'