Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio n. 5
0
 def accept_product_delete(driver):
     """
     Accept project delete message
     :param driver: browser web driver
     """
     BasePage.alert_accept_click(driver)