Ejemplo n.º 1
0
 def delete_selected_file(driver):
     """
     Delete file that was selected by checkbox
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver, Locators.delete_file_button_locator)
     alert_message = "Are you sure?"
     wait_for_alert(driver, alert_message, delay=3)
     BasePage.alert_accept_click(driver)
Ejemplo n.º 2
0
 def delete_selected_images(driver):
     """
     Delete selected images from opencart
     :param driver: browser web driver
     """
     BasePage.click_on_object(driver,
                              locator=Locators.delete_images_button_locator)
     wait_for_alert(driver, alert_message="Are you sure?", delay=2)
     BasePage.alert_accept_click(driver)
     wait_for_alert(
         driver,
         alert_message="Success: Your file or directory has been deleted!")
     BasePage.alert_accept_click(driver)
Ejemplo n.º 3
0
 def download_file(driver, file_url):
     """
     Download file
     :param file_url: full url to downloadable file
     :param driver: browser web driver
     """
     wait_for_element(driver, Locators.file_upload_button_locator, delay=3)
     driver.find_element(*Locators.file_upload_button_locator).click()
     keyboard = Controller()
     keyboard.press(Key.esc)
     keyboard.release(Key.esc)
     driver.find_element(*Locators.file_download_dynamic_locator).send_keys(file_url)
     alert_message = "Your file was successfully uploaded!"
     wait_for_alert(driver, alert_message, delay=3)
     BasePage.alert_accept_click(driver)
     BasePage.click_on_object(driver, Locators.save_downloaded_file)
Ejemplo n.º 4
0
 def add_new_images_to_store(driver, images_path, *file_names):
     """
     Add images to the opencart store
     :param driver: browser web driver
     :param images_path: path to images tuple
     :param file_names: names of images we wanna to load
     """
     dirname = os.path.dirname(images_path)
     for arg in file_names:
         filename = os.path.join(str(dirname), str(arg))
         wait_for_element(driver,
                          Locators.image_download_button_locator,
                          delay=3)
         driver.find_element(
             *Locators.image_download_button_locator).click()
         keyboard = Controller()
         keyboard.press(Key.esc)
         keyboard.release(Key.esc)
         driver.find_element(
             *Locators.image_download_dynamic_locator).send_keys(filename)
         alert_message = "Success: Your file has been uploaded!"
         wait_for_alert(driver, alert_message, delay=3)
         BasePage.alert_accept_click(driver)
Ejemplo n.º 5
0
 def accept_product_delete(driver):
     """
     Accept project delete message
     :param driver: browser web driver
     """
     BasePage.alert_accept_click(driver)