Exemplo n.º 1
0
 def screenshots(self, file_name):
     self.window.scroll_to_top()
     if self.get_total_height_to_scroll() != 0:
         frames = 0
         files = []
         scroll = 0
         offset = 0
         attempts = 0
         file_name_tupla = file_name.split(".")
         while not self.window.is_bottom_page():
             self.window.scroll_by((0, scroll))
             while self.window.offset_position() < offset:
                 time.sleep(0.1)
                 attempts += 1
                 if attempts == 5:
                     raise Exception('The page is not scrolling')
             height = self.window.page_height()
             file_screenshot = file_name_tupla[0] + "_" + str(
                 frames) + "_." + file_name_tupla[1]
             self.get_screenshot(file_screenshot)
             self.cut_strategy(scroll, height, file_screenshot)
             files.append(file_screenshot)
             scroll = self.calculate_scroll()
             offset += scroll
             frames += 1
         Cropper.merge_images(file_name, files)
         self._remove_files(files)
     else:
         self.get_screenshot(file_name)
Exemplo n.º 2
0
 def cut_last_frame(self, file_name, scroll):
     pixels = self.__calculate_fixed_top()
     not_fixed = self.__calculate_not_fixed_area()
     img = Cropper.image(file_name)
     cuts = pixels + (not_fixed - scroll)
     img2 = Cropper.crop_top(img, self.convert_size_ratio(cuts))
     img2.save(file_name)
Exemplo n.º 3
0
 def cut_last_frame(self, file_name, scroll):
     borders = self.window.get_fixed_border()
     pixels = borders["top"]
     not_fixed = self.window.page_height() - (borders["top"] +
                                              borders["bottom"])
     img = Cropper.image(file_name)
     cuts = pixels + (not_fixed - scroll)
     img2 = Cropper.crop_top(img, self.convert_size_ratio(cuts))
     img2.save(file_name)
Exemplo n.º 4
0
 def cut_bottom(self, file_name):
     pixels = self.__calculate_fixed_bottom()
     img = Cropper.image(file_name)
     img2 = Cropper.crop_bottom(img, self.convert_size_ratio(pixels))
     img2.save(file_name)
Exemplo n.º 5
0
 def clean_screenshot(self, image_path):
     image = Cropper.image(image_path)
     crops = self.window.get_crops()
     image = Cropper.crop(image, crops["x"], crops["y"], crops["width"],
                          crops["height"])
     Cropper.save(image, image_path)
Exemplo n.º 6
0
 def cut_bottom(self, file_name):
     borders = self.window.get_fixed_border()
     pixels = borders["bottom"]
     img = Cropper.image(file_name)
     img2 = Cropper.crop_bottom(img, self.convert_size_ratio(pixels))
     img2.save(file_name)