diff --git a/README.md b/README.md index f414b53caa9..ecc89fdebeb 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase) [![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -**Test Automation Framework for Python** +**A Test Automation Framework for Python** ![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase") @@ -586,7 +586,7 @@ Delayed Data Manager usage example: If you scheduled an email to go out 12 hours ### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Wrap-Up -Congratulations! You now know how to **Automate like a Pro!** +Congratulations on making it through this ReadMe tutorial! Questions or Comments? [![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -594,11 +594,7 @@ Here are some other exciting open source projects on GitHub by smart people I've [https://github.com/hubspot](https://github.com/hubspot) ~ Michael Mintz
-[https://github.com/mdmintz](https://github.com/mdmintz)
[https://www.linkedin.com/in/mdmintz](https://www.linkedin.com/in/mdmintz) - - -### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") License - -[The MIT License!](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) +[https://github.com/mdmintz](https://github.com/mdmintz)
+[https://www.linkedin.com/in/mdmintz](https://www.linkedin.com/in/mdmintz) ![](https://cdn2.hubspot.net/hubfs/100006/images/logo_base_10.png "SeleniumBase") diff --git a/_config.yml b/_config.yml index 1c2af117821..fc3f8f5c8e7 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,3 @@ theme: jekyll-theme-cayman title: SeleniumBase -description: Framework for building test automation \ No newline at end of file +description: A simple Python framework for building test automation with WebDriver \ No newline at end of file diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md index 1ad6b76ef89..4f2a06a4adc 100755 --- a/help_docs/method_summary.md +++ b/help_docs/method_summary.md @@ -89,6 +89,14 @@ self.download_file(file_url, destination_folder=None) self.save_file_as(file_url, new_file_name, destination_folder=None) +self.get_downloads_folder(file): + +self.get_path_of_downloaded_file(file): + +self.is_downloaded_file_present(file): + +self.assert_downloaded_file(file): + self.convert_xpath_to_css(xpath) self.convert_to_css_selector(selector, by) diff --git a/seleniumbase/core/download_helper.py b/seleniumbase/core/download_helper.py index df1de221fca..45979ddcb30 100755 --- a/seleniumbase/core/download_helper.py +++ b/seleniumbase/core/download_helper.py @@ -27,9 +27,12 @@ def reset_downloads_folder(): ARCHIVE_DIR) if not os.path.exists(archived_downloads_folder): os.makedirs(archived_downloads_folder) - archived_downloads_folder = "%sdownloads_%s" % ( + new_archived_downloads_sub_folder = "%s/downloads_%s" % ( archived_downloads_folder, int(time.time())) - shutil.move(downloads_path, archived_downloads_folder) + shutil.move(downloads_path, new_archived_downloads_sub_folder) os.makedirs(downloads_path) if not settings.ARCHIVE_EXISTING_DOWNLOADS: - shutil.rmtree(archived_downloads_folder) + try: + shutil.rmtree(new_archived_downloads_sub_folder) + except OSError: + pass diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index ed0bbd0f3c5..89bc701dbf3 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -38,6 +38,7 @@ class MyTestClass(BaseCase): from seleniumbase.core.testcase_manager import TestcaseDataPayload from seleniumbase.core.testcase_manager import TestcaseManager from seleniumbase.core import browser_launcher +from seleniumbase.core import download_helper from seleniumbase.core import log_helper from seleniumbase.fixtures import constants from seleniumbase.fixtures import page_actions @@ -688,6 +689,23 @@ def save_file_as(self, file_url, new_file_name, destination_folder=None): page_utils._download_file_to( file_url, destination_folder, new_file_name) + def get_downloads_folder(self): + """ Returns the OS path of the Downloads Folder. + (Works with Chrome and Firefox only, for now.) """ + return download_helper.get_downloads_folder() + + def get_path_of_downloaded_file(self, file): + """ Returns the OS path of the downloaded file. """ + return os.path.join(self.get_downloads_folder(), file) + + def is_downloaded_file_present(self, file): + """ Checks if the file exists in the Downloads Folder. """ + return os.path.exists(self.get_path_of_downloaded_file(file)) + + def assert_downloaded_file(self, file): + """ Asserts that the file exists in the Downloads Folder. """ + assert os.path.exists(self.get_path_of_downloaded_file(file)) + def convert_xpath_to_css(self, xpath): return xpath_to_css.convert_xpath_to_css(xpath) diff --git a/server_setup.py b/server_setup.py index 085c1b7b621..7767f0f50cc 100755 --- a/server_setup.py +++ b/server_setup.py @@ -8,7 +8,7 @@ setup( name='seleniumbase', - version='1.4.14', + version='1.4.15', description='Web Automation & Testing Framework - http://seleniumbase.com', long_description='Web Automation and Testing Framework - seleniumbase.com', platforms='Mac * Windows * Linux * Docker', diff --git a/setup.py b/setup.py index cbebe786a2d..d723cf920d8 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ """ The setup package to install SeleniumBase dependencies and plugins -(Uses the newer Selenium 3.6.0) +(Uses the newer Selenium 3.8.0) """ import os @@ -8,7 +8,7 @@ setup( name='seleniumbase', - version='1.4.14', + version='1.4.15', description='Web Automation & Testing Framework - http://seleniumbase.com', long_description='Web Automation and Testing Framework - seleniumbase.com', platforms='Mac * Windows * Linux * Docker',