def create(self,
               tablename,
               data,
               success=True,
               dbcallback=None,
               components={}
               ):

        browser = self.browser
        result = {}
        id_data = []
        table = current.s3db[tablename]

        settings = current.deployment_settings
        date_format = str(settings.get_L10n_date_format())
        datetime_format = str(settings.get_L10n_datetime_format())
        # If a confirmation is shown then clear it so that it doesn't give a false positive later
        try:
            elem = self.get_confirmation(0.2)
            elem.click()
            time.sleep(1)  # Give it time to dissolve
        except:
            pass

        # Fill in the Form
        for details in data:
            el_id = "%s_%s" % (tablename, details[0])
            el_value = details[1]
            if len(details) >= 4:
                time.sleep(details[3])
            if len(details) >= 3:
                el_type = details[2]
                if el_type == "checkbox":
                    for value in el_value:
                        self.browser.find_element_by_xpath("//label[contains(text(),'%s')]" % value).click()
                        # @ToDo: Add value to id_data to check for create function
                elif el_type == "inv_widget":
                    raw_value = self.w_inv_item_select(el_value,
                                                       tablename,
                                                       details[0],
                                                       )
                elif el_type == "supply_widget":
                    raw_value = self.w_supply_select(el_value,
                                                     tablename,
                                                     details[0],
                                                     )
                elif el_type == "facility_widget":
                    raw_value = self.w_facility_select(el_value,
                                                       tablename,
                                                       details[0],
                                                       )
                elif el_type == "gis_location":
                    self.w_gis_location(el_value,
                                        details[0],
                                        )
                    raw_value = None
                else:  # Embedded form fields
                    el_id = "%s_%s" % (el_type, details[0])
                    el = browser.find_element_by_id(el_id)
                    el.send_keys(el_value)
                    raw_value = None

            else:
                # Look for autocomplete input field.
                el = browser.find_elements_by_id("dummy_"+el_id)
                if len(el) != 0:
                    # Autocomplete input found.
                    el = el[0]
                else:
                    el = browser.find_element_by_id(el_id)
                class_name = el.get_attribute("class")
                if "generic-widget" in class_name:
                    # Dropdown option
                    raw_value = False
                    options_list = el.find_elements_by_tag_name("option")
                    # Find the Longest Word Trimmed Match that matches with el_value
                    option = self.find_max_match(options_list, el_value)
                    if option is None:
                        raise NoSuchElementException("%s option could not be found in %s" % (el_value, el_id))
                    option.click()
                    raw_value = option.get_attribute("value")
                    try:
                        raw_value = int(raw_value)
                    except:
                        pass

                    # Test that we have an id that can be used in the database
                    if el_value and el_value != "-":
                        self.assertTrue(raw_value, "%s option cannot be found in %s" % (el_value, el_id))
                elif "ui-autocomplete-input" in class_name:
                    # Autocomplete field
                    raw_value = self.w_autocomplete(el_value,
                                                    el_id,
                                                    el_value,
                                                    )
                elif isinstance(table[details[0]].widget, S3DateWidget):
                    el_value_date = datetime.datetime.strptime(el_value, "%Y-%m-%d") # %H:%M:%S")
                    el_value = el_value_date.strftime(date_format)
                    el.clear()
                    el.send_keys(el_value)
                    raw_value = el_value_date
                elif isinstance(table[details[0]].widget, S3DateTimeWidget):
                    el_value_datetime = datetime.datetime.strptime(el_value, "%Y-%m-%d %H:%M:%S")
                    el_value = el_value_datetime.strftime(datetime_format)
                    el.clear()
                    el.send_keys(el_value)
                    #raw_value = el_value_datetime
                    raw_value = None
                    # @ToDo: Fix hack to stop checking datetime field. This is because the field does not support data entry by key press
                    # Use the raw value to check that the record was added succesfully
                else:
                    # Normal text input
                    el.clear()
                    el.send_keys(el_value)
                    raw_value = el_value
            if raw_value:
                id_data.append([details[0], raw_value])

        result["before"] = self.getRows(table, id_data, dbcallback, components)

        # Submit the Form
        submit_btn = browser.find_element_by_css_selector("input[type='submit']")
        submit_btn.click()
        #self.wait_for_page_to_load()

        # Check & Report the results
        confirm = True
        try:
            elem = self.get_confirmation(3)
            self.reporter(elem.text)
        except (NoSuchElementException, TimeoutException):
            confirm = False

        if (confirm != success):
            # Do we have a validation error?
            try:
                elem_error = browser.find_element_by_xpath("//div[@class='error']")
                if elem_error:
                    msg = "%s %s" % (elem_error.get_attribute("id"), elem_error.text)
                    self.reporter(msg)
            except NoSuchElementException:
                pass

        if success:
            self.assertTrue(confirm, "Confirmation of record creation not received.\nRecord - %s" % data)
        else:
            self.assertFalse(confirm, "Unexpected confirmation of record creation received.\nRecord - %s" % data)

        # Database Checks
        result["after"] = self.getRows(table, id_data, dbcallback, components)
        successMsg = "Records added to database: %s" % id_data
        failMsg = "Records not added to database %s" % id_data
        if success:
            self.assertTrue((len(result["after"]) - len(result["before"])) == 1,
                            failMsg)
            self.reporter(successMsg)
        else:
            self.assertTrue((len(result["after"]) == len(result["before"])),
                            successMsg)
            self.reporter(failMsg)
        return result

    # -------------------------------------------------------------------------
Required. Deletes an object referenced by obj_id.
dataset/ETHPy150Open sahana/eden/modules/tests/web2unittest.py/SeleniumUnitTest.create--crossover with--dataset/ETHPy150Open openstack/horizon/horizon/tables/actions.py/DeleteAction.delete