'Upload image specified by image_selector and file_to_upload'

def upload_image(self, upload_btn_selector, file_to_upload):

    self.wait_for_element_visibility(upload_btn_selector, u'upload    button    is    present')
    self.q(css=upload_btn_selector).results[0].click()
    self.wait_for_element_presence(self.upload_image_popup_window_selector, u'upload    dialog    is    present')
    filepath = SettingsPage.get_asset_path(file_to_upload)
    self.q(css=self.upload_image_browse_button_selector).results[0].send_keys(filepath)
    self.q(css=self.upload_image_upload_button_selector).results[0].click()
    self.wait_for_element_absence(self.upload_image_popup_window_selector, u'upload    dialog    is    hidden')
