def test_take_explicit_webpage_screenshot(self):
     page = GooglePage(driver=self.driver, url="http://www.google.com")
     page.open().wait_for_page_load()
     file = page.take_screenshot()
     filepath = "{}/{}.png".format(seleniumconfig.screenshot_dir, file)
     assert os.path.exists(
         filepath
     ), "Expecting that a screenshot was taken and saved here: {}".format(
         filepath)
 def test_take_multiple_webpage_screenshots_with_same_name(self):
     """
     The expectation is that they overwrite each other
     """
     page = GooglePage(driver=self.driver, url="http://www.google.com")
     page.open().wait_for_page_load()
     num_files_before = self.count_files(seleniumconfig.screenshot_dir)
     time.sleep(1)
     file1 = page.take_screenshot()
     time.sleep(2)
     file2 = page.take_screenshot(screenshot_name=file1)
     file3 = page.take_screenshot(screenshot_name=file1)
     filepath = "{}/{}.png".format(seleniumconfig.screenshot_dir, file1)
     time.sleep(3)
     num_files_after = self.count_files(seleniumconfig.screenshot_dir)
     assert file1 == file2 and file2 == file3, "I'm expecting the files to the same if taken really fast - file1: {} - file2: {} - file3: {}".format(
         file1, file2, file3)
     assert os.path.exists(
         filepath
     ), "Expecting that a screenshot was taken and saved here: {}".format(
         filepath)
     assert num_files_after == (
         num_files_before +
         1), "Expecting there to be 1-more screenshot taken"